Version 1 (modified by trac, 16 years ago) ( diff )

--

{{Template:GUI_Object|button|[wiki:GUI_-_Properties#buffer_zone 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}}

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.

Image:gui-object-button.png

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

The buttons work as in Windows, you can press it, but the action isn't committed until the button is released.

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[
          
          ]]></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[
          
          ]]></action>
  </object>
Note: See TracWiki for help on using the wiki.