[SOLVED] Adding widgets to TabItem's


09-03-2009 16:24:18

item = tab->addItem("This is a tabitem");
item->createWidget(...); // will create a widget positioned at the top-left corner of the "tab-content-window" (this is the effect I want with the code below...)

text = mygui->createWidget("StaticText", ..., IntCoord(0,0, 20, 40));
text->attachToWidget(item); // will attached the text positioned in front of the "tab-bars" (not what I want)

How can i achieve the effect of creating a subwidget of a TabItem with the attach/detach methods..?

If I dynamically attach a widget to another, there seem to be no relative positions


11-03-2009 15:57:26

Same goes with a StaticText dynamically attached to a window. The StaticText is'nt moving along with thw window..?


11-03-2009 16:46:03

Call text->setWidgetStyle(MyGUI::WidgetStyle::Child); by default widgets attached in Popup mode.


14-03-2009 15:15:44

I tried, but now the window is frozen and I cant resize/move it. Both widget's layers is set to "Back" ?
And is there a way to when I attach something to let's say a Window, I want widget that Im attaching to be positioned relative to the "window-content-area", i.e. not relative from its top-left title area? Because when i create a statictext at pos (0,0) and attach it to the window, the text appear in front of the window's titlebar.


14-03-2009 16:31:10

Oh, looks like there was bug.

Fixed, update from svn.


15-03-2009 19:51:01

Hi! It worked after I updated from SVN. Thanks!

However, it only applies to Window widget. Can it be fixed for Tab bars (when i create a new TabItem) as well?


15-03-2009 20:21:27

I fixed it for all widgets, it was bug in core, not in some widget.
In Tab widget there's no single client area as in Window widget. Tab have many sheet so you should manually select where to attach your widget and you shoudn't directly attach to Tab widget. Something like this:
MyGUI::TabItemPtr item = tab->getItemAt(0); // first sheet
By the way, can you tell my why you attaching widgets so often?

EDIT: Hm, isn't it same thing that you doing?


15-03-2009 20:39:12

This is what i do:
item = tab-addItem("MyTab!");
text = mygui->createWidget("StaticText", ..., ...);
text->setCaption("this is a text");
text->attachToWidget(item); // now "this is a text" appears in front of "MyTab" and not in the content area

By the way, can you tell my why you attaching widgets so often?
I'm having a thin wrapper of MyGUI into my engine for some widgets to have the ability to compose a gui of separate widgets.

EDIT: sry, I had written item->setWidgetStyle(::Child) instead of text->setWidgetStyle(::Child). Now it works perfectly. Thank you!