[v2.x] Center text in item of multilist.

nec

27-04-2010 00:34:10

Hello,

I would like center the items of my multilist but i can't find anything to do this. How should i proceed?

thx

Altren

27-04-2010 01:17:39

You should change skin.

There is ListLine skin used for lines in all Lists and MultiLists. You can change it's align. Or create copy of that skin if you don't want to change other Lists skin.

Here's example (simple copy of default skins with "_Center" and replaced align in ListLine_Center:TextAlign)
<Skin name = "ListLine_Center" size = "5 5" texture = "#{MyGUI_Theme_Texture}" >
<Property key="FontName" value = "Default" />
<Property key="TextAlign" value = "HCenter VCenter" />

<Child type="StaticImage" skin="PopupMenuLineIcon" offset = "-10 0 12 15" align = "Right VCenter" name = "Image"/>

<BasisSkin type="MainSkin" offset = "0 0 5 5">
<State name="normal" offset = "343 115 1 1"/>
<State name="highlighted" offset = "306 115 1 1"/>
<State name="normal_checked" offset = "318 115 1 1"/>
<State name="pushed" offset = "330 115 1 1"/>
</BasisSkin>

<BasisSkin type="SimpleText" offset = "2 0 1 5" align = "Stretch">
<State name="disabled" colour="#{MyGUI_Theme_Button_ColourNormal}"/>
<State name="normal" colour="#{MyGUI_Theme_Button_ColourNormal}"/>
<State name="highlighted" colour="#{MyGUI_Theme_Button_ColourNormal}"/>
<State name="normal_checked" colour="#{MyGUI_Theme_Button_ColourPushed}"/>
<State name="pushed" colour="#{MyGUI_Theme_Button_ColourPushed}"/>
</BasisSkin>
</Skin>

<Skin name = "MultiSubList_Center" size = "9 9" texture = "#{MyGUI_Theme_Texture}">
<Property key="NeedKey" value = "true" />
<Property key="SkinLine" value = "ListLine_Center" />
<Property key="HeightLine" value = "20" />

<Child type="VScroll" skin="VScroll" offset = "-7 0 16 9" align = "Right VStretch" name = "VScroll"/>
<Child type="Widget" skin="Default" offset = "0 0 -7 9" align = "Stretch" name = "Client"/>

</Skin>

<Skin name = "MultiList_Center" size = "11 11" texture = "#{MyGUI_Theme_Texture}">
<Property key="NeedKey" value = "true" />
<Property key="SkinButton" value = "MultiListButton" />
<Property key="HeightButton" value = "21" />
<Property key="SkinList" value = "MultiSubList_Center" />
...