add/change/remove text to text area, textinput

hellaeon

14-02-2009 03:09:08

This sounds silly, but how can I get to the specific methods of a widget such as for a textarea->addText() method etc after loading widgets and such from a sheet?

I can access the widget and assign event handlers but say how can I access an example as above?
I have a textarea and textinputs I want to be able to grab and change text from, add to them etc.
I cant figure out how to get the instance of my textarea or textinput and actually do these operations.

Can someone just show me some simple code?
Im presuming it would start with

QuickGUI::TextArea *t = NULL;

then.........

Sorry to be blunt but i'm lost on getting my sheet controls....
cheers

kungfoomasta

14-02-2009 05:27:12

No problem, its a big library, lots of APIs to learn. :)

If you know the name of the widget, you can use the following API:


/**
* Recursively searches through children and returns first widget found with widget_name given.
* NULL is returned if the widget is not found.
*/
virtual Widget* findWidget(const Ogre::String& widget_name);


Here is an example:

QuickGUI::TextArea* t = dynamic_cast<QuickGUI::TextArea*>(mySheet->findWidget("My Text Area Name"));

The TextArea has a lot of Text functions such as:

addText
addTextLine
clearText
getText
setText