LavishGUI:listbox (Element Type)

From Lavish Software Wiki
Revision as of 23:22, 15 December 2005 by Beefalo (talk | contribs)
Jump to navigation Jump to search

Introduction

What is a List Box?

A listbox is a box to display a list of items for a user to choose one or more items from. lguilistbox (Data Type) and lguilistboxitem (Data Type) are used to provide access via LavishScript.

Using List Boxes

List Boxes are descendants of the base element type. Any attributes of the base element type may be applied in addition to the list box-specific properties described below.

List Box-Specific Properties

  • BackgroundColor
Background color
  • Border
Size of border around the element. This border is included in the size of the element
  • BorderColor
Border color
  • Font
Font reference (Name, Size, Color)
  • Items
Container element for list items
  • SelectMultiple
Enable if the list box should allow multiple items to be selected
  • SelectionColor
Selection highlight color
  • Sort
None, User (allows users to drag items to reorder them), Text, Value
  • Texture
Texture, if any

Embedded Script

  • OnSelect
Executes when an item is selected. Integer variable ID contains the ID of the newly selected item.
  • OnDeselect
Executes when an item is selected. Integer variable ID contains the ID of the deselected item.

List Items

List items are defined within the Items container element with an "Item" tag. Items may have a Value attribute, which indicates a whole number value to be associated with the item. Items may also have a Color attribute, which indicates the text color to be used for that particular item. Text contained by the Item begin and end tags will be used as the displayed text of the list item.


Examples

	<listbox name='TestListBox'>
		<X>400</X>
		<Y>400</Y>
		<Width>120</Width>
		<Height>120</Height>
		<SelectMultiple>1</SelectMultiple>
		<Sort>Text</Sort>
		<Texture filename='Listbox.png'/>
		<Items>
			<Item Value='1'>Item1</Item>
			<Item Value='2'>Item2</Item>
		</Items>
	</listbox>

See Also