[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [paragui-users] RICHEDIT
From: |
Eric Ross |
Subject: |
RE: [paragui-users] RICHEDIT |
Date: |
Wed, 4 Sep 2002 11:57:12 -0400 (CLT) |
On Wed, 4 Sep 2002, John Rainey wrote:
> Is this issue being addressed? I'd would like to submit a series of changes,
> include the fix to Set Text and a added xml property for the richedit tag
> to read in text from a file but would like to know
If you have a patche, just post it here so we can review your changes.
If it look ok, im sure it will be included.
> [snip]
>
> This is do to setting the std:string my_text to the const char* text
> parameter
> when text points to the buffer in the my_text std:string,in the
> PG_Widget::SetText function.
> There is no guarantee when setting a std:string that it will not deallocate
> it's current
> buffer and make a new one. That is indeed what happens. consequently the new
> buffer
> is blank which is of course what the const char* text points to.
>
> I fixed the problem by creating a tempory std:string to receive the text
> value, then set my_text to that temporary string.
>
> void PG_Widget::SetText(const char* text) {
>
> //added by jpr
> // to fix bug if text points to buffer of my_text
> std::string temptext=text;
> my_internaldata->widthText = TXT_HEIGHT_UNDEF;
> my_internaldata->heightText = TXT_HEIGHT_UNDEF;
>
> if(text == NULL) {
> my_text = "";
> return;
> }
> //added by jpr
> my_text = temptext;
> Update();
> }
Your're right. This is curious. There's some SetText(GetText()) in the
pgwidget.cpp file. This produces that the my_text= line became
"my_text=my_text.c_str()". I'd like to fix it just changing the
"my_text=text" to "my_text=string(text)". Is this OK for you ? and does it
work ?
> [snip]
>
> object_end:
> // jpr why is the text being reset?????
> XMLParser->ParentObject->AddText(" ", true);
> }
In this line the text is not reset. It's adding a white space (why? i dont
know), but i dont think it's so important. More important is that in
PG_Widget::AddText, there's a "my_text += text". The problem is that in
this function, there's a call to "SetText(GetText())" and it suffers the
problem you discovered.
Can you try the "string(text)" thing and tell us if it works ? This way i
can include it in the cvs.
--
- RE: [paragui-users] RICHEDIT, John Rainey, 2002/09/04
- RE: [paragui-users] RICHEDIT,
Eric Ross <=
- RE: [paragui-users] RICHEDIT, John Rainey, 2002/09/04
- RE: [paragui-users] RICHEDIT, Eric Ross, 2002/09/04
- RE: [paragui-users] RICHEDIT, John Rainey, 2002/09/05
- Re[2]: [paragui-users] RICHEDIT, taurus, 2002/09/05
- Re: Re[2]: [paragui-users] RICHEDIT, Eric Ross, 2002/09/05
- Re[4]: [paragui-users] RICHEDIT, taurus, 2002/09/09
- RE: Re[4]: [paragui-users] RICHEDIT, John Rainey, 2002/09/09
- Re[4]: [paragui-users] RICHEDIT, Eric Ross, 2002/09/09
- Re[5]: [paragui-users] RICHEDIT, taurus, 2002/09/10
- RE: Re[4]: [paragui-users] RICHEDIT, John Rainey, 2002/09/10