paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] RICHEDIT


From: Alexander Pipelka
Subject: Re: [paragui-users] RICHEDIT
Date: Sun, 8 Sep 2002 00:40:53 +0200
User-agent: KMail/1.4.3

Hi John!

The PG_Richedit widget was written by a guy who isn't part of the project 
anymore :))
Well, I never really got acquainted with that widget :-/

If you've some ideas to improve it, do it, ...

You can post a patch to the list or maybe you'll create an account at savannah 
for CVS r/w access (whatever you prefer).
Feel free to change things in the PG_Richedit code (aslong it binary 
compatible).

Alex

Am Freitag, 30. August 2002 22:30 schrieb John Rainey:
> I've been trying to use a richedit widget
> created by the layout manager. I'm using rel-1-0-3 from CVS.
> I've come across a curios problem, the layout manager creates the
> richedit widget and sets it's text property which parses the text and
> completes the lines. Then when XMLEndDoc is called the widget addtext
> function is called adding an empty string to the richedit my_text member.
> This call clears out the my_text member.
>
> It works fine for other widgets such as popups, dropdowns,
> and buttons but clears the my_text member of the richedit which gets parsed
> and clears all the text from the richedit text maps previously loaded when
> processing the tag.
>
> 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.
>
> This still requires the text to be parsed twice??? Why is the line
>
> object_end:
>               XMLParser->ParentObject->AddText(" ", true);
>
> in the layout code XMLEndDoc procedure?
>
> XMLParser->ParentObject->AddText("", true);
>
> 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();
> }
>
> static void XMLEndDoc(void *userData, const char *name) {
>       ParseUserData_t *XMLParser = (ParseUserData_t *)userData;
>       PG_Widget               *WidgetToAdd = NULL;
>
>       //if (XMLParser->Section & XML_SECTION_FONT)
>       //      XMLTextDoc(userData, PG_FFT_END_TAG , 2);
>
>       if ((XMLParser->EndTagFlags & ENDTAGFLAG_SETSIZE) != 0) {
>
> XMLParser->ParentObject->SetSizeByText(XMLParser->Width,XMLParser->Height);
>       }
>
>       if ((XMLParser->EndTagFlags & ENDTAGFLAG_OBJECT) != 0) {
>               if (((XMLParser->InhTagFlags & INHTAGFLAG_ADDWIDGET) != 0) &&
> ((XMLParser->EndTagFlags & ENDTAGFLAG_WIDGETLIST) == 0)) {
>                       WidgetToAdd = XMLParser->ParentObject;
>                       goto object_end;
>               }
>
>               if ((XMLParser->InhTagFlags & INHTAGFLAG_HIDE) == 0)
>                       if(XMLParser->ParentObject->GetParent() == NULL) {
>                               XMLParser->ParentObject->Show();
>                       }
>               else
>                       XMLParser->ParentObject->Hide();
>
> object_end:
>               // jpr why is the text being reset?????
>               XMLParser->ParentObject->AddText(" ", true);
>       }
>
>       RestoreUserData(XMLParser);
>
>       if (WidgetToAdd == NULL) {
>               return;
>       }
>
>       ((PG_WidgetList *)(XMLParser->ParentObject))->AddWidget(WidgetToAdd);
> }
>
>
>
> _______________________________________________
> paragui-users mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]