[Solved]Parenting Issues

mprestia

18-09-2009 15:25:45

Hello,

I'm also trying to attach and detach widgets to and from other widgets. When I attach to a widget, I set the style of the child and it works fine:


// Attach the child to the widget
child->attachToWidget(parent);

// Set the widget as a child
child->setWidgetStyle(MyGUI::WidgetStyle::Child);


But when I detach the child from the parent, the child just disappears. I still have a pointer to the widget, but it doesn't appear in the main window and it doesn't show up when I attach the widget to a different parent:


// Detach the child from the widget
child->detachFromWidget();

// Set the style of the child
child->setWidgetStyle(MyGUI::WidgetStyle::Popup);


I tried removing the line to set the style back to Popup, but the same improper behavior was produced. Am I missing some setting?

Thanks,
Mike

my.name

18-09-2009 19:00:59

Widget* parent = gui->createWidget(...
Widget* child = parent->createWidget( ...

child->setWidgetStyle(MyGUI::WidgetStyle::Popup);
MyGUI::LayerManager::getInstance().attachToLayerNode("Overlapped", child);

mprestia

18-09-2009 19:08:17

That works beautifully! Thanks!