how to write template(solved)

haibo19981984

02-03-2011 09:29:04


<Resource type="ResourceLayout" name="ButtonImage" version="3.2.0">
<Widget type="Widget" skin="ButtonEmptySkin" position="20 20 16 16" name="Root">
<Property key="TextAlign" value="Center"/>
<Property key="FontName" value="Default"/>
<UserString key="LE_TargetWidgetType" value="Button"/>
<Widget type="ImageBox" skin="ImageBox" position="0 0 16 16" align="Stretch" name="Image">
<Property key="NeedMouse" value="false"/>
</Widget>
</Widget>
<Widget type="Button" skin="ButtonImage" position="20 55 32 32">
<Property key="Caption" value="test"/>
<Property key="ImageResource" value="PointerArrowImage"/>
</Widget>
</Resource>

Above is in MyGUI_BlueWhiteTemplates.xml.
I don't understand some script in it,such as:
(1)position="20 20 16 16"
I can understand "16 16",it is button's size.
What is "20 20"?
(2)key="LE_TargetWidgetType"
What is the function of the script?
"LE" is LayoutEditor.exe?
(3)<Widget type="Button" skin="ButtonImage" position="20 55 32 32">
<Property key="Caption" value="test"/>
<Property key="ImageResource" value="PointerArrowImage"/>
</Widget>
I don't find skin "ButtonImage" in MyGUI_BlueWhiteSkins.xml.
So I don't understand it.
It seems a button that use text "test" and image "PointerArrowImage".

<Resource type="ResourceLayout" name="ButtonImage">
<Widget type="Widget" skin="PanelEmpty" position="20 20 16 16" name="Root">
<Widget type="ImageBox" skin="ImageBox" position="0 0 16 16" align="Stretch" name="Image">
<Property key="NeedMouse" value="false"/>
</Widget>
</Widget>
</Resource>

above is my ButtonImage.
I only want a ButtonImage which has only an image.

Altren

02-03-2011 12:57:55

First of all I hope that you edit templates in layout editor and not by hands.
1) Position of Root widget is ignored, this is just some position initially used in editor.
2) LE_TargetWidgetType: LE mean LayoutEditor, this is widget type that template is designed for and this property is used to show available template properties.
3) You can remove this widget at all, it is used in development stage to see result and test template behaviour.

haibo19981984

02-03-2011 14:55:52

thanks for your reply.