| 1 | {{Template:GUI_Object|radiobutton|[wiki:GUI_-_Properties#buffer_zone buffer_zone], [wiki:GUI_-_Properties#caption caption], [wiki:GUI_-_Properties#cell_id cell_id], [wiki:GUI_-_Properties#checked checked], [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#sprite2 sprite2], [wiki:GUI_-_Properties#sprite2_over sprite2_over], [wiki:GUI_-_Properties#sprite2_pressed sprite2_pressed], [wiki:GUI_-_Properties#sprite2_disabled sprite2_disabled], [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]|none}} |
| 2 | |
| 3 | A Radio-button is a control that defines a boolean value, i.e. true or false. It contains a squared sprite and text next to it. |
| 4 | |
| 5 | The square itself can have 8 different kinds of sprites (although many are optional): false, false-over, false-pressed and false-disabled, true, true-over, true-pressed, true-disabled ... false and true being ''checked''="true" and ''checked''="false". ''sprite'' represents false, and ''sprite2'' true. |
| 6 | |
| 7 | By pressing the Radio-button one can change its value (using the same behaviour as a button); that includes the text too. When a Radio-button is pressed (this is what differentiate it from the [wiki:GUI_-_Check-box Check-box]), and turned to true, all other ''sibling'' Radio-buttons turn false. |
| 8 | |
| 9 | [wiki:Image:gui-object-radiobutton.png] |
| 10 | |
| 11 | To create a group of Radio-buttons, use preferably an empty <object> tag: |
| 12 | |
| 13 | {{{ |
| 14 | <object> |
| 15 | <object type="radiobutton">...</object> |
| 16 | <object type="radiobutton">...</object> |
| 17 | <object type="radiobutton">...</object> |
| 18 | </object> |
| 19 | }}} |
| 20 | |
| 21 | '''''Code of example radiobuttons:''''' |
| 22 | |
| 23 | {{{ |
| 24 | <object> |
| 25 | <object type="radiobutton" |
| 26 | size="20 20 200 40" |
| 27 | sprite="gd-radio-false" |
| 28 | sprite2="gd-radio-true" |
| 29 | square_side="16" |
| 30 | checked="false" |
| 31 | font="verdana12" |
| 32 | textcolor="0 0 0" |
| 33 | >Radiobutton |
| 34 | </object> |
| 35 | |
| 36 | <object type="radiobutton" |
| 37 | size="20 50 200 70" |
| 38 | sprite="gd-radio-false" |
| 39 | sprite2="gd-radio-true" |
| 40 | square_side="16" |
| 41 | checked="true" |
| 42 | font="verdana12" |
| 43 | textcolor="0 0 0" |
| 44 | >This is a radiobutton that spans more than just one row. |
| 45 | </object> |
| 46 | </object> |
| 47 | }}} |