Trying to understand resources - Window[C][S][X]

simed

16-11-2011 14:56:26

I'm trying to get better understanding how MyGUI works internally. I was looking how Window is designed:
<Resource type="ResourceLayout" name="WindowCSX" version="3.2.0">
<Widget type="Widget" skin="PanelEmpty" position="15 10 68 49" name="Root">
<Property key="Snap" value="true"/>
<UserString key="LE_TargetWidgetType" value="Window"/>
<Widget type="Widget" skin="WindowFrameSkin" position="0 28 68 20" align="Stretch">
<Widget type="Widget" skin="ClientTileSkin" position="4 2 58 12" align="Stretch" name="Client"/>
<Widget type="Button" skin="WindowResizeRightDownSkin" position="57 9 9 9" align="Right Bottom" name="ResizeRightBottom">
<Property key="Pointer" value="size_left"/>
</Widget>
<Widget type="Button" skin="WindowResizeLeftDownSkin" position="0 9 9 9" align="Left Bottom" name="ResizeLeftBottom">
<Property key="Pointer" value="size_right"/>
</Widget>
</Widget>
<Widget type="Widget" skin="CaptionWithButtonSkin" position="0 0 68 28" align="HStretch Top">
<Widget type="Button" skin="ButtonCloseSkin" position="44 6 18 17" align="Right Top" name="Button">
<UserString key="Event" value="close"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="7 1 29 22" align="HStretch Top" name="Caption">
<Property key="TextColour" value="0 0 0"/>
<Property key="TextAlign" value="Center"/>
<Property key="FontName" value="Default"/>
</Widget>
</Widget>
</Widget>
<Widget type="Window" skin="WindowCSX" position="15 75 68 49">
<Property key="Caption" value="Text"/>
</Widget>
</Resource>
I have a few specific questions, but any more general info is very useful - is there any good explanation in wiki you can direct me to?
  1. How does this get used: <UserString key="Event" value="close"/> In my code, I put event handler on eventWindowButtonPressed and check the name is "close"... but this bit of XML makes me wonder if I can hook directly to close event?[/*:m]
  2. Why do you have separate "Root" widget with all the functionality, and then the actual WindowCSX widget underneath? How are the two connected?[/*:m][/list:u]

Altren

16-11-2011 16:11:45

How does this get used: <UserString key="Event" value="close"/> In my code, I put event handler on eventWindowButtonPressed and check the name is "close"... but this bit of XML makes me wonder if I can hook directly to close event?
http://www.ogre3d.org/tikiwiki/MyGUI+ad ... WindowSkin
Why do you have separate "Root" widget with all the functionality, and then the actual WindowCSX widget underneath? How are the two connected?They were there only for checking skin right there in layout editor (removed inr revision 4332), only Root widget is used in skin.

simed

16-11-2011 16:27:45

Thanks. I'll update my MyGUI source.