mprestia
17-09-2009 15:06:33
Hello,
I'm having some problems creating widgets. I'm creating them as follows:
mWidget = GUIInst->createWidget<MyGUI::StaticImage>("Default", left, top, width, height, MyGUI::Align::Left, "Main", name);
However, about half of the widgets produce an assert internally in MyGUI. Here is what happens:
static image -> doesn't render
combo box -> Child Widget Client not found in skin (Edit must have Client) -from MyGUI log
list -> Child VScroll not found in skin (List must have VScroll) -from MyGUI log
render box -> hard crash
VScroll -> Child Button Track not found in skin (Scroll must have Track) -from MyGUI log
HScroll -> Child Button Track not found in skin (Scroll must have Track) -from MyGUI log
tab -> Child Widget Bar not found in skin (Tab must have Bar) -from MyGUI log
menu ctrl -> Child Widget Client not found in skin (MenuCtrl must have Client) -from MyGUI log
menu bar -> Child Widget Client not found in skin (MenuCtrl must have Client) -from MyGUI log
popup -> Child Widget Client not found in skin (MenuCtrl must have Client) -from MyGUI log
message box -> Child Text not found in skin (MessageBox must have widget for text) -from MyGUI log
[/list:u]
If I create any of these types in a layout and then load that layout, all of these types work fine.
Any help would be greatly appreciated.
Thanks,
Mike
mprestia
17-09-2009 15:07:52
Obviously, I don't use the static image template to create everything. I use the appropriate template for each type.
Altren
17-09-2009 16:56:44
"Default" is skin name, so you should use proper string here: most common names is same as widget names - for example GUIInst->createWidget<MyGUI::Button>("Button", ...
mprestia
17-09-2009 22:11:20
Thanks! That fixed all but one. I'm still getting the same error with the MenuCtrl widget. I'm using "MenuCtrl" as the skin. Is there somewhere I can look up the default skins for widgets?
mprestia
17-09-2009 22:34:48
Ok, apparently I lied. It aslo didn't work for the DDContainer widget.
mrmclovin
18-09-2009 20:52:27
Thanks! That fixed all but one. I'm still getting the same error with the MenuCtrl widget. I'm using "MenuCtrl" as the skin.
As far as i know, it's best to create MenuCtrl through a MenuItem.
mMenuCtrl = mMenuItem->createItemChild();
Is there somewhere I can look up the default skins for widgets?
I'd also like something like this. But I think it's also the MyGUI community's responsible help set it up

maybe I will do some wikiwork tomorrow!
I have a similar problem, but it can't be solved by the discribed way:
My Code: gui_info_background_ = MyGUI::Gui::getInstancePtr()->createWidget<MyGUI::StaticImage>("StaticImage", 0, 0, 1024, 100, MyGUI::ALIGN_DEFAULT, "Top", "info_bg");
gui_info_background_->setImageTexture("green.png");
But it shows nothing.
Some more strange stuff?
I wanna to fade this widget in and out. So I manipulate the alpha value in this way: alpha_img_ += game_env_.render_time * 3;
gui_info_background_->setAlpha( alpha_img_ );
Usually this is supposed to work quite well and it does, but the problem is, that now another element is faded out which is loaded from a layout sheet.
It looks like:
<Widget type="StaticImage" skin="StaticImage" position_real="0.0 0.9479166666667 1 0.0520833333333" layer="Back" name="bg_dark">
<Property key="Image_Texture" value="bg_dark.png"/>
</Widget>
I don't know, what is wrong with that. Is it maybe because of "getinstancePtr()"?
my.name
13-10-2009 20:46:59
gui_info_background_ = MyGUI::Gui::getInstancePtr()->createWidget<MyGUI::StaticImage>("StaticImage", 0, 0, 1024, 100, MyGUI::Align::Default, "Back", "info_bg");
gui_info_background_->setImageTexture("green.png");
The probem had another reason.
I destroyed every gui-object before loading the hud. But now it is solved. Thanks youn anyway.
But there is still one question: How to center a new text widget?
I tried: gui_info_text_ = MyGUI::Gui::getInstancePtr()->createWidget<MyGUI::StaticText>("StaticText", 10, 5, game_env_.window->getWidth(), lines_ * 22, MyGUI::Align::HCenter, "Back", id_ + "_info_text");
But this won't really work. Maybe beacause I set the text value later. So I tried: gui_info_text_->setAlign( MyGUI::Align::HCenter );
after setCaption(), but this isn't working, too.
So is it possible to center a text widget, which is created in my application?
my.name
13-10-2009 23:14:25
parent->setSize(parent->getSize());
Mhm it is not working.
This is, what it looks like:
gui_info_background_ = MyGUI::Gui::getInstancePtr()->createWidget<MyGUI::StaticImage>("StaticImage", 0, 0, game_env_.window->getWidth(), lines_ * 22 + 10, MyGUI::Align::Default, "Back", id_ + "_info");
gui_info_background_->setImageTexture("bg.png");
gui_info_background_->setAlpha(0.0);
gui_info_text_ = gui_info_background_->createWidget<MyGUI::StaticText>("StaticText", 10, 5, gui_info_background_->getSize().width, lines_ * 22, MyGUI::Align::Center, id_ + "_info_text");
gui_info_text_->setFontName( "LinLib_20");
gui_info_text_->setFontHeight( 25 );
gui_info_text_->setCaption( info_text_ );
gui_info_text_->setTextColour(Ogre::ColourValue(0.8, 0.8, 0.8));
gui_info_text_->setAlpha(0.0);
gui_info_background_->setSize( gui_info_background_->getSize() );
gui_info_text_->setAlign( MyGUI::Align::Center );
my.name
14-10-2009 12:29:31
gui_info_text_->setAlign( MyGUI::Align::Center );
gui_info_background_->setSize( gui_info_background_->getSize() );
Unfortunately it is not working...
my.name
16-10-2009 12:15:31
gui_info_text_->setTextAlign( MyGUI::Align::Center );
Thank you! Now it's working
my.name
17-10-2009 11:19:09
gui_info_background_ = MyGUI::Gui::getInstancePtr()->createWidget<MyGUI::StaticImage>("StaticImage", 0, 0, game_env_.window->getWidth(), lines_ * 22 + 10, MyGUI::Align::Default, "Back", id_ + "_info");
gui_info_background_->setImageTexture("bg.png");
gui_info_background_->setAlpha(0.0);
gui_info_text_ = gui_info_background_->createWidget<MyGUI::StaticText>("StaticText", 10, 5, gui_info_background_->getSize().width, lines_ * 22,
MyGUI::Align::Stretch, id_ + "_info_text");
gui_info_text_->setFontName( "LinLib_20");
gui_info_text_->setFontHeight( 25 );
gui_info_text_->setCaption( info_text_ );
gui_info_text_->setTextColour(Ogre::ColourValue(0.8, 0.8, 0.

);
gui_info_text_->setAlpha(0.0);
//gui_info_background_->setSize( gui_info_background_->getSize() );
gui_info_text_->setTextAlign( MyGUI::Align::Center );