| 1 | {{Template:GUI_Object|list|[wiki:GUI_-_Properties#buffer_zone buffer_zone], [wiki:GUI_-_Properties#cell_id cell_id], [wiki:GUI_-_Properties#font font], [wiki:GUI_-_Properties#list list], [wiki:GUI_-_Properties#scrollbar scrollbar], [wiki:GUI_-_Properties#scrollbar_style scrollbar_style], [wiki:GUI_-_Properties#selected selected], [wiki:GUI_-_Properties#sprite sprite], [wiki:GUI_-_Properties#sprite_selectarea sprite_selectarea], [wiki:GUI_-_Properties#text_align text_align], [wiki:GUI_-_Properties#textcolor textcolor], [wiki:GUI_-_Properties#textcolor_selected textcolor_selected]|[wiki:GUI_-_Actions#SelectionChange SelectionChange]}} |
| 2 | A ''list'' consists of a number of elements, wherein one can be selected at once. |
| 3 | |
| 4 | A scrollbar can be attached to the right of the list. |
| 5 | [[BR]] |
| 6 | [wiki:Image:gui-object-list.png][[BR]] |
| 7 | Notice that the size doesn't reach all the way to the edge, this is because the sprite is slightly extruded; it is a trick that makes the scrollbar looks as if it is placed within the control. |
| 8 | [[BR]][[BR]] |
| 9 | Add list entries with the <item> tag: |
| 10 | |
| 11 | {{{ |
| 12 | <!-- A list box --> |
| 13 | <object name="list1" |
| 14 | type="listbox" |
| 15 | size="50 50 150 170" |
| 16 | > |
| 17 | <!-- Additional options --> |
| 18 | <item>Select 1</item> |
| 19 | <item>Select 2</item> |
| 20 | </object> |
| 21 | }}} |
| 22 | |
| 23 | To learn how to manipulate the list items with Javascript, see [wiki:Exposed_GUI_Functions#List_functions List functions]. |
| 24 | |
| 25 | '''''Code of example list:''''' |
| 26 | {{{ |
| 27 | <object type="list" |
| 28 | size="20 20 170 242" |
| 29 | sprite="gd-input" |
| 30 | scrollbar="true" |
| 31 | scrollbar_style="gd-scrollbar" |
| 32 | font="verdana12" |
| 33 | buffer_zone="5" |
| 34 | sprite_selectarea="gd-blue" |
| 35 | textcolor="0 0 0" |
| 36 | textcolor_selected="255 255 255" |
| 37 | > |
| 38 | <item>Superfluous</item> |
| 39 | <item>Gregarious</item> |
| 40 | <item>Erudite</item> |
| 41 | <item>Insouciant</item> |
| 42 | <item>Salubrious</item> |
| 43 | <item>Verbiage</item> |
| 44 | <item>Ascribe</item> |
| 45 | <item>Jovial</item> |
| 46 | <item>Adamant</item> |
| 47 | <item>Desideratum</item> |
| 48 | <item>Ersatz</item> |
| 49 | <item>Solace</item> |
| 50 | <item>Triskaidekaphobia</item> |
| 51 | <item>Stoic</item> |
| 52 | <item>Encumbrance</item> |
| 53 | <item>Puerile</item> |
| 54 | </object> |
| 55 | }}} |