Child window and controls
« on: 27 July 2013, 23:35:54 »
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

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Child window and controls
« Reply #1 on: 27 July 2013, 23:51:35 »
There is only one difference.
Because child window itself is a pointer, you have to pass its value.
Code: [Select]
tgui::Button::Ptr button(gui);
tgui::Button::Ptr button2(*child); // child is a tgui::ChildWindow::Ptr

Re: Child window and controls
« Reply #2 on: 28 July 2013, 00:04:55 »
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

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Child window and controls
« Reply #3 on: 28 July 2013, 00:24:17 »
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.
Code: [Select]
tgui::Button* button = gui.add<tgui::Button>();
tgui::Button* button2 = child->add<tgui::Button>();