Form Elements - List
| User Guide Contents | Buy Orthello Form Elements | C# Class Reference | Download 100% Free Edition
The OTListElement
Use the OTListElement to present the user with a list of choices. Each choice will be presented by a OTButtonElement. The choice texts can be provided through an items array or an items text file. You can set the list to be single select or multi select. The list element will use the box child clipped area sprite in combination with the auto generated vertical form slider to achieve the scrolling part.
The OTListElement only supports vertcal scrolling text-based lists using buttons.
Within a form element, each (sprite) child can have a child 'focus' that will be made visible when this elements gets form focus.
The two child elements that must exist in the OTListElement are :
- 'box' clipped area sprite
This sprite is specifies the list clipping box en is used to create the clipping area on screen. - 'item' OTButtonElement
The default item element that will be repeated for each list item.
The button element names 'item' should have a normal, hover, active sprite and a caption text sprite.
You are free to put additional child sprites that can have their own focus childs in this element. This way you can customize background or highlights.
In addition to the OTFormElement base class, the OTListElement has the following properties :
- string value
The value is actually of type object, so use stringValue to get the right value as a string.
This value will contain the item indexes of the selected item(s) - int selectedItemIndex
Index of the selected item - string selectedItem
text of the selected item - int[] selectedItemIndexes
Array with indexes of the selected items of the multi select list. - string[] selectedItems
Array with strings that contain the item text of the selected items of the multi select list. - int clipLayerId (default 20)
int clipMargin (default 2)
Clipping area sprite settings. - string[] items
Array with item strings for the list - TextAsset itemsText
A text file with the items for this list. Each item must have its own line in the text file. - bool multiSelect
When true , more than one item can be selected. - OTElementAction selectAction
This action will be executed when an item is selected.
An action has the following properties:- component
On this component a GameObject.SendMessage() will be called. - message
The SendMessage method that is called. So by calling 'Button', the receiving component should have one or more scripts that have a mathod void Button(string value). - value
This value is passed as a string parameter to the message method that exist in the scripts of the action component.
- component
- OTElementAction deSelectAction
This item will be executed when an items becomes deselected.
| Previous : OTTextInputElement |