{{Template:GUI_Object|button| buffer_zone, caption, cell_id, font, sprite, sprite_over, sprite_pressed, sprite_disabled, text_align, text_valign, textcolor, textcolor_over, textcolor_pressed, textcolor_disabled, tooltip, tooltip_style|Press}}

Button

A button consists of a sprite filling all of its size and text that can be placed in any alignment. When hovered, pressed or disabled, both the sprite and the text colour can be changed.

No image "gui-object-button.png" attached to GUI_-_Button

The left button has got both text_align and text_valign set to "center", this means buffer_zone is completely unused.

The press event is called as soon as the left mouse button is pressed down.

Examples

Code of example buttons:

  <object type="button"
          name="The_one_to_the_left" 
          size="20 20 170 80"
          sprite="gd-button"
          sprite_pressed="gd-button-pressed"
          text_align="center"
          text_valign="center"
          font="verdana12"
          textcolor="0 0 0"
          textcolor_pressed="255 255 255">
          Centered
          <action on="Press"><![CDATA[ doSomething(); ]]></action>
  </object>
  
  <object type="button"
          name="The_one_to_the_right" 
          size="210 20 360 80"
          sprite="gd-button"
          sprite_pressed="gd-button-pressed"
          text_align="left"
          text_valign="bottom"
          buffer_zone="20"
          font="verdana12"
          textcolor="0 0 0"
          textcolor_pressed="255 255 255">
          Press
          <action on="Press"><![CDATA[ doSomething(); ]]></action>
  </object>
Last modified 5 years ago Last modified on Feb 3, 2014, 2:52:53 PM