Button Control

From DevWiki

Revision as of 14:09, 4 April 2011 by Riegersn (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Applications,Boxee GUI API,Controls

Contents


Overview

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

  1. <control type="button" id="100">
  2.    <description>login button control</description>
  3.    <posx>80</posx>
  4.    <posy>60</posy>
  5.    <width>200</width>
  6.    <height>40</height>
  7.    <visible>true</visible>
  8.    <colordiffuse>FFFFFFFF</colordiffuse>
  9.    <texturefocus>button_login_on.png</texturefocus>
  10.    <texturenofocus>button_login.png</texturenofocus>
  11.    <label>Click Me!</label>
  12.    <font>font21</font>
  13.    <textcolor>white</textcolor>
  14.    <disabledcolor>88FFFFFF</disabledcolor>
  15.    <align>left</align>
  16.    <aligny>center</aligny>
  17.    <textoffsetx>20</textoffsetx>
  18.    <textoffsety>-</textoffsety>
  19.    <onfocus>-</onfocus>
  20.    <onup>110</onup>
  21.    <ondown>120</ondown>
  22.    <onleft>130</onleft>
  23.    <onright>140</onright>
  24.    <onclick>ActivateWindow(14002)</onclick>
  25. </control>


Available Tags

In addition to the Default Control Properties the following tags are available. Note that all XML tags are in lower case.

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


Python Integration

In addition to the default control methods (disable/enable, visibility and focus), the following is also available for this control type.

GetButton(controlId:Integer):Button
The button class represents a button control in the user interface.

  1. myButton = mc.GetActiveWindow().GetButton(140)
  1. <onclick lang="python"><![CDATA[
  2. myButton = mc.GetActiveWindow().GetButton(140)
  3. ]]></onclick>


GetLabel

GetLabel():String
Get the label of a button.

  1. oldLabel = myButton.GetLabel()


SetLabel

SetLabel(label:String):Void
Set the label of a button.

  1. myButton.SetLabel('Play')
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox