Child window and controls

Started by Jimmyee, 27 July 2013, 23:35:54

Jimmyee

How can I add controls to a child window and handle them? It seems different than it is done in the main GUI window...

texus

There is only one difference.
Because child window itself is a pointer, you have to pass its value.
tgui::Button::Ptr button(gui);
tgui::Button::Ptr button2(*child); // child is a tgui::ChildWindow::Ptr

Jimmyee

Oh OK. I think I'm using depreciated version because Button::Ptr doesn't exit for me. I guess I should update to v0.6 ;) Thank you.

texus

You didn't say what version you were using so I just gave an answer without even considering that you may have been using a different version.

If you are just starting with tgui then using v0.6 might indeed be better because it is a huge improvement, it just lacks tutorials.

In v0.5 this would have been what you needed.
tgui::Button* button = gui.add<tgui::Button>();
tgui::Button* button2 = child->add<tgui::Button>();