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

--

{{Template:GUI_Object|list|[wiki:GUI_-_Properties#buffer_zone buffer_zone], cell_id, font, list, scrollbar, scrollbar_style, selected, sprite, sprite_selectarea, text_align, textcolor, textcolor_selected|SelectionChange}} A list consists of a number of elements, wherein one can be selected at once.

A scrollbar can be attached to the right of the list.
Image:gui-object-list.png
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.

Add list entries with the <item> tag:

  <!-- A list box -->
  <object name="list1"
          type="listbox" 
          size="50 50 150 170"
  >
          <!-- Additional options -->
          <item>Select 1</item>
          <item>Select 2</item>
  </object>

To learn how to manipulate the list items with Javascript, see List functions.

Code of example list:

  <object type="list" 
          size="20 20 170 242" 
          sprite="gd-input"
          scrollbar="true"
          scrollbar_style="gd-scrollbar"
          font="verdana12"
          buffer_zone="5"
          sprite_selectarea="gd-blue"
          textcolor="0 0 0"
          textcolor_selected="255 255 255"			
  >
          <item>Superfluous</item>
          <item>Gregarious</item>
          <item>Erudite</item>
          <item>Insouciant</item>
          <item>Salubrious</item>
          <item>Verbiage</item>
          <item>Ascribe</item>
          <item>Jovial</item>
          <item>Adamant</item>
          <item>Desideratum</item>
          <item>Ersatz</item>
          <item>Solace</item>
          <item>Triskaidekaphobia</item>
          <item>Stoic</item>
          <item>Encumbrance</item>
          <item>Puerile</item>
  </object>
Note: See TracWiki for help on using the wiki.