Skip to main content

History: MyGUI widget control

Source of version: 4

Copy to clipboard
            !!Create
Manual
Creating widget without parent:
{CODE(wrap="1",colors="cpp",wiki="1")}
MyGUI::Gui::getInstance().createWidget<MyGUI::__widget_type__>("__skin_name__", __x__, __y__, __w__, __h__, MyGUI::__Align__, "__layer_name__"['', "__widget_name__"'']);
MyGUI::Gui::getInstance().createWidgetReal<MyGUI::__widget_type__>("__skin_name__", __x_r__, __y_r__, __w_r__, __h_r__, MyGUI::__Align__, "__layer_name__"['', "__widget_name__"'']);{CODE}

Creating child widget:

{CODE(wrap="1",colors="cpp",wiki="1")}
parent_ptr->createWidget<MyGUI::__widget_type__>("__skin_name__", __x__, __y__, __w__, __h__, MyGUI::__Align__ ['', "__widget_name__"'']);
parent_ptr->createWidgetReal<MyGUI::__widget_type__>("__skin_name__", __x_r__, __y_r__, __w_r__, __h_r__, MyGUI::__Align__ ['', "__widget_name__"'']);{CODE}

Possible __widget_type__ values can be found at ((MyGUI|__MyGUI main page__)).

__skin_name__ can be same as widget or any from ((MyGUI|__MyGUI main page__)).

__x__, __y__, __w__, __h__ is widget position width and height in pixels.

__x_r__, __y_r__, __w_r__, __h_r__ is widget position width and height in relative to parent (or screen if no parent) coordinates from 0. to 1..

Possible __align__ values can be found in ((MyGUI align table|__align table__)).

All __layer_name__s can be found in ((MyGUI layers|standart layers)).

__widget_name__ is optional parameter.

!!Find
To find widget (for example Button)
{CODE(wrap="1",colors="cpp",wiki="1")}
MyGUI::Button* button = MyGUI::Gui::getInstance().findWidget<MyGUI::Button>("button_name");{CODE}
or if you don't care about widget type you can write
{CODE(wrap="1",colors="cpp",wiki="1")}MyGUI::Widget* any_widget = MyGUI::Gui::getInstance().findWidget__T__("widget_name");{CODE}

!!Destroy
To destroy widget you need to have widget pointer (__widget_ptr__). Then write
{CODE(wrap="1",colors="cpp",wiki="1")}MyGUI::Gui::getInstance().destroyWidget(__widget_ptr__);{CODE}
If you don't have pointer you should get it by finding your widget by name.
{CODE(wrap="1",colors="cpp",wiki="1")}MyGUI::Widget* widget = MyGUI::Gui::getInstance().findWidgetT("widget_name");
MyGUI::Gui::getInstance().destroyWidget(widget);{CODE}

        

History

Information Version
Sat 25 of Feb, 2012 00:00 GMT-0000 Datalore a few more minor grammar changes 6
Fri 24 of Feb, 2012 23:59 GMT-0000 Datalore fixed minor grammar mistakes 5
Tue 23 of Nov, 2010 02:40 GMT-0000 Altren 4
Tue 23 of Nov, 2010 02:39 GMT-0000 Altren 3
Mon 28 of Dec, 2009 05:45 GMT-0000 jacmoe 2
Sun 29 of Mar, 2009 13:44 GMT-0000 Beauty [[Category:GUI]] 1