| 1 | {{Template:GUI_Object|button|[wiki:GUI_-_Properties#buffer_zone buffer_zone], [wiki:GUI_-_Properties#caption caption], [wiki:GUI_-_Properties#cell_id cell_id], [wiki:GUI_-_Properties#font font], [wiki:GUI_-_Properties#sprite sprite], [wiki:GUI_-_Properties#sprite_over sprite_over], [wiki:GUI_-_Properties#sprite_pressed sprite_pressed], [wiki:GUI_-_Properties#sprite_disabled sprite_disabled], [wiki:GUI_-_Properties#text_align text_align], [wiki:GUI_-_Properties#text_valign text_valign], [wiki:GUI_-_Properties#textcolor textcolor], [wiki:GUI_-_Properties#textcolor_over textcolor_over], [wiki:GUI_-_Properties#textcolor_pressed textcolor_pressed], [wiki:GUI_-_Properties#textcolor_disabled textcolor_disabled], [wiki:GUI_-_Properties#tooltip tooltip], [wiki:GUI_-_Properties#tooltip_style tooltip_style]|[wiki:GUI_-_Actions#Press Press]}} |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | [wiki:Image:gui-object-button.png] |
| 6 | |
| 7 | The left button has got both ''text_align'' and ''text_valign'' set to "center", this means ''buffer_zone'' is completely unused. |
| 8 | |
| 9 | The buttons work as in Windows, you can press it, but the action isn't committed until the button is released. |
| 10 | |
| 11 | '''''Code of example buttons:''''' |
| 12 | |
| 13 | {{{ |
| 14 | <object type="button" |
| 15 | name="The_one_to_the_left" |
| 16 | size="20 20 170 80" |
| 17 | sprite="gd-button" |
| 18 | sprite_pressed="gd-button-pressed" |
| 19 | text_align="center" |
| 20 | text_valign="center" |
| 21 | font="verdana12" |
| 22 | textcolor="0 0 0" |
| 23 | textcolor_pressed="255 255 255" |
| 24 | >Centered |
| 25 | <action on="Press"><![CDATA[ |
| 26 | |
| 27 | ]]></action> |
| 28 | </object> |
| 29 | |
| 30 | <object type="button" |
| 31 | name="The_one_to_the_right" |
| 32 | size="210 20 360 80" |
| 33 | sprite="gd-button" |
| 34 | sprite_pressed="gd-button-pressed" |
| 35 | text_align="left" |
| 36 | text_valign="bottom" |
| 37 | buffer_zone="20" |
| 38 | font="verdana12" |
| 39 | textcolor="0 0 0" |
| 40 | textcolor_pressed="255 255 255" |
| 41 | >Press |
| 42 | <action on="Press"><![CDATA[ |
| 43 | |
| 44 | ]]></action> |
| 45 | </object> |
| 46 | }}} |