[SOLVED] A few problems..

andrewfenn

27-03-2009 19:00:28

My first problem is that putting together too many strings makes MyGUI segfault.

The following code works as expected.

mStatusText->setCaption(
Ogre::String("1")+
Ogre::String("2")
);


However this code below segfaults.

mStatusText->setCaption(
Ogre::String("1")+
Ogre::String("2")+
Ogre::String("3")
);


Here is how mStatusText is defined

mStatusText = MyGUI::Gui::getInstance().findWidget<MyGUI::StaticText>("status");

and here is "status" from my layout..

<Widget type="StaticText" skin="StaticText" position="13 15 323 49" layer="Back" name="status">
<Property key="Widget_InheritsAlpha" value="true"/>
<Property key="Widget_Alpha" value="100"/>
<Property key="Text_TextColour" value="1,1,1,1"/>
<Property key="Text_TextAlign" value="Center"/>
<Property key="Text_FontName" value="DejaVuSans.17"/>
<Property key="Text_FontHeight" value="17"/>
</Widget>


My next problem is that as you can see above I have set the text colour white however upon loading the layout I have to set the colour in code before it changes.

My last problem is that I also have the following static images defined in my layout..

<Widget type="StaticImage" skin="StaticImage" position="40 80 30 30" layer="Back">
<Property key="Image_Name" value="dot1"/>
<Property key="Image_Texture" value="dot.zworks.png"/>
<Property key="Widget_Alpha" value="40"/>
<Property key="Widget_InheritsAlpha" value="true"/>
</Widget>
<Widget type="StaticImage" skin="StaticImage" position="260 80 30 30" layer="Back">
<Property key="Image_Name" value="dot3"/>
<Property key="Image_Texture" value="dot.zworks.png"/>
<Property key="Widget_InheritsAlpha" value="true"/>
<Property key="Widget_Alpha" value="40"/>
</Widget>
<Widget type="StaticImage" skin="StaticImage" position="150 77 35 35" layer="Back">
<Property key="Image_Name" value="dot2"/>
<Property key="Image_Texture" value="dot.zworks.png"/>
<Property key="Widget_InheritsAlpha" value="true"/>
<Property key="Widget_Alpha" value="40"/>
</Widget>


As you can see I have set the alpha on all three images to be 40, however within my program it is no transparent at all. I haven't tried setting the alpha within my code yet to see if that resolves the problem.

I should also note the the last two problems I am also experiencing when I load up my layout within the layout editor too. I didn't include my full layout, only selected pieces.

Ed: I just updated my copy to the latest version of MyGUI in SVN and I still have all three problems.

Altren

27-03-2009 19:58:28

First change your layouts. Widget_Alpha is float value from 0 to 1, so instead <Property key="Widget_Alpha" value="40"/> you need to write <Property key="Widget_Alpha" value="0.4"/>, next: colour is "1 1 1 1" (without commas) or "#FFFFFF".
mStatusText->setCaption(
Ogre::String("1")+
Ogre::String("2")+
Ogre::String("3")
);
Works fine for me: try to debug.

andrewfenn

27-03-2009 20:53:06

ah, great. Thanks for solving those two issues. :)

I'll take another bash at the first one.

andrewfenn

28-03-2009 12:30:42

Ok, I finally found a solution which was to change the variables I was putting into setcaption from Ogre::String to Ogre::UTFString

After that my program didn't crash anymore so I am guessing it's some kind of conversion problem between normal ogre strings and UTF strings?