create text boxes in a recursive way & take control


25-01-2008 10:52:48

i'd like to create text boxes in recursive way, and if i try this code all works well:

TextBox *tb1;

for(int i=0;i<5;++i)
tb1 = panel->createTextBox(;

and all text boxes display on my panel.
but i have a question: is there a way to take control of the text boxes created? i explain better my idea.
i want to add event handlers for all the text boxes.
i tried to store the tb1 pointer in a vector (see above the vTextB) and try this>addEventHandler(QuickGUI::Widget::EVENT_MOUSE_CLICK,&SimpleGUIDemoApp::tbMBDown,this);

but the change is only in the last text box created.
is there a way to take control of them?


25-01-2008 17:37:05

Here is the problem:

Consider trying this:


25-01-2008 19:08:05

well, i have noted that obviously if i do how you say it works... :oops:
but now, my "problem" is the event handler...
in my event handler, when i have an EVENT_MOUSE_CLICK, i clear the text.
how can i take the text box that have fired the event?
maybe args have something that can help me?


25-01-2008 19:18:37

The WidgetEventArgs will give you access to the Widget that fired the event.


25-01-2008 20:02:25

wow!!! now it works!!!
thanks a lot kungfoomasta! i haven't read that part of the wiki... :oops: