Attach/Embed to child window

Started by Gleade, 03 November 2014, 14:52:26

Gleade

Hello, I've been using SFML for a while now & recently started using TGUI.

I was just wondering if it was possible to embed other widgets (e.g chatbox) to a child window? if so, how is it done? I tried to work it out from the documentation & searching the forums but no luck. Thanks in advance.

texus

In v0.6, you have to pass the child window to the constructor of the widget. But you have to remember to dereference the pointer, otherwise you will get some very strange errors.
tgui::ChildWindow::Ptr child(gui);
child->load("Black.conf");

tgui::ChatBox::Ptr chatBox(*child);
chatBox->load("Black.conf");


In v0.7-dev you would just use the add function.
auto child = tgui::ChildWindow::create("Black.conf");
gui.add(child);

auto chatBox = tgui::ChatBox::create("Black.conf");
child->add(chatBox);

Gleade

Thank you! that worked perfectly :)