Button Control

From DevWiki

Jump to: navigation, search

Back to UI Control List

Button controls are used to create push buttons on the application window. The buttons can be customized for position, size, looks and text and have several events for push and navigation. Buttons can also be contained in grouplists which makes it much simpler to automatically position and navigate between them.

Example
<control type="button" id="100">
   <description>login button control</description>
   <posx>80</posx>
   <posy>60</posy>
   <width>200</width>
   <height>40</height>
   <visible>true</visible>
   <colordiffuse>FFFFFFFF</colordiffuse>
   <texturefocus>button_login_on.png</texturefocus>
   <texturenofocus>button_login.png</texturenofocus>
   <label>Click Me!</label>
   <font>font21</font>
   <textcolor>white</textcolor>
   <disabledcolor>88FFFFFF</disabledcolor>
   <align>left</align>
   <aligny>center</aligny>
   <textoffsetx>20</textoffsetx>
   <textoffsety>-</textoffsety>
   <onfocus>-</onfocus>
   <onup>110</onup>
   <ondown>120</ondown>
   <onleft>130</onleft>
   <onright>140</onright>
   <onclick lang="python">
<![CDATA[
config = mc.GetLocalConfig()
config.SetValue('mysetting', '43.5')
config.SetValue('mysetting2', 'true')
]]>
   </onclick>
</control>
This control contains the following properties in addition to the default control properties
Element Description Required
texturefocus Specifies the image file which should be displayed when the button has focus. No
texturenofocus Specifies the image file which should be displayed when the button does not have focus. No
label The label used on the button. It can be a link into strings.xml, or an actual text label. No
font Font used for the button label. From the skin /720p/fonts.xml. No
textcolor Color used for displaying the button label. In AARRGGBB hex format or a name from the skin color themes /colors/defaults.xml. No
focusedcolor Color used for the button label when the button has in focus. In AARRGGBB hex format or a name from the skin color themes /colors/defaults.xml. No
disabledcolor Color used for the button label if the button is disabled. In AARRGGBB hex format or a name from the skin color themes /colors/defaults.xml. No
shadowcolor Specifies the color of the drop shadow on the text. In AARRGGBB hex format or a name from the skin color themes /colors/defaults.xml. No
angle The angle the text should be rendered at, in degrees. A value of 0 is horizontal. No
align Label horizontal alignment on the button. Defaults to left, can also be center or right. No
aligny Label vertical alignment on the No
textoffsetx Amount to offset the label from the left (or right) edge of the button when using left or right alignment. No
textoffsety Amount to offset the label from the top edge of the button when using top alignment. No


Events
Element Description Required
onclick Specifies actions or a python script which will run when the button is pressed. You may have more than one <onclick> tag, and they’ll be executed in sequence. Yes
onfocus Specifies actions or a python script which will run when the button is focused. The action is performed after any focus animations have completed. No
Personal tools