Attach/Embed to child window
« on: 03 November 2014, 14:52:26 »
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

  • *****
  • 1163
    • View Profile
    • Texus's Blog
Re: Attach/Embed to child window
« Reply #1 on: 03 November 2014, 14:58:44 »
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.
Code: [Select]
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.
Code: [Select]
auto child = tgui::ChildWindow::create("Black.conf");
gui.add(child);

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

Re: Attach/Embed to child window
« Reply #2 on: 03 November 2014, 15:15:18 »
Thank you! that worked perfectly :)