Ripiz
07-04-2012 09:07:17
Hello,
I'm trying to figure how to create widgets at runtime, instead of loading from file, and place them inside specific widget (window), I tried few widget's methods but I couldn't get it work. Maybe anyone could help out?
I'm trying to figure how to create widgets at runtime, instead of loading from file, and place them inside specific widget (window), I tried few widget's methods but I couldn't get it work. Maybe anyone could help out?
// find window where to place widgets
MyGUI::Window *myWindow = GUI.findWidget<MyGUI::Window>("ToolWindow");
// create and initialize widget
MyGUI::TextBox *myLabel = myWindow->createWidget<MyGUI::TextBox>("", 30, 30, 100, 30, MyGUI::Align::Left | MyGUI::Align::Top);
myLabel->setCaption("MyLabel");
/* I thought this would be enough, but it wasn't. I tried the following lines individually, and their combination, but no luck */
myLabel->attachToWidget(myWindow);
myWindow->addChildItem(myLabel);