Changing Widget name


27-02-2011 21:40:22

How do you change widget's name?

By the way, as I always refer widgets to their name for my Construct plugin, so it would be great that all widgets that create widgets set a name to them :)


27-02-2011 22:35:18

What's the point of changing widget's name? There's no way to rename it now, but it's very easy to implement.

When you create widget last optional parameter of createWidget function is widget's name.

27-02-2011 23:39:50

void setWidgetName(MyGUI::Widget* _widget, const std::string& _name)
_widget->setUserString("NewWidgetName", _name);

std::string getWidgetName(MyGUI::Widget* _widget)
if (_widget->isUserString("NewWidgetName"))
return _widget->getUserString("NewWidgetName");
return _widget->getName();


28-02-2011 08:58:05

My concern is that in my plugin, the user uses only the widget name to address it.
I know that you can specify widget's name at creation but for widget created by MyGUI (e.g. ItemBox), no name is specified so users of my plugin cannot access them.

So, I need a find a way to be sure that all widgets have a name, so I will not have empty name when I call MyGUI function that uses widget name as input.


28-02-2011 18:13:03

Ok, I will use's solution. It's not perfect but I will deal with that. With this method I cant use MyGUI::Gui::getInstance().findWidget<T>()

Thanks for the help!