A dropdownlist item is used to place a drop-down list in the rollout. The user can click open the list and scroll or click again to select an item in the list. The syntax is:
dropdownlist <name> [ <caption> ] [ items:<array_of_strings> ] \
[ selection:<number> ] [ height:<number> ]
The default alignment of dropdownList items is #left.
Example:
dropdownlist scale_dd "Scale" items:#("1/2", "1/4", "1/8", "1/16")
on scale_dd selected i do
format "You selected %\n!" scale_dd.items[i]
Parameters
items:
The array of text strings that are the items in the list.
selection:
The 1-based number of the currently selected item in the list. Defaults to 1.
height:
The overall height of the dropdownlist in number of item lines. Defaults to 10 lines. To have a dropdownlist exactly display N items in the list, set height to N+2.
Properties
<dropdownlist>.items Array
The item string array.
<dropdownlist>.selection Integer
The currently selected item number, 1-based. If the items list is an empty array, this value is 0.
<dropdownlist>.selected String
The text of the currently selected item. Can be set to replace individual items without resetting the entire items array. If the items list is an empty array, this value is undefined.
Events
on <dropdownlist> selected <arg> do <expr>
Called when the user selects an item in the drop-down list. The <arg> argument contains the new current selection item number.
Example:
rollout test "t"
(
dropdownlist dd "dd" items:#("1","2","3","4","5","6","7","8","9","10") height:6
label l "L"
)
rof=newrolloutfloater "A" 200 200
addrollout test rof
you will get 5 items in the dropdown list. Change height to 5, and you get 3.
See also
Rollout User-Interface Items Common Properties