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:
rollout ddl_test "Drop-Down List"
(
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]
)
createDialog ddl_test
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.
The minimum height value is clamped to 1 line.
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.
<dropdownlist>.width Integer
Get/set the width of the dropdownlist in pixels.
<dropdownlist>.height Integer
Get/set the height of the dropdownlist in pixels.
Events
on <dropdownlist> selected <arg> do <expr>
Called when the user selects an item in the drop-down list. The <arg> argument will contain the new current selection item number.
Example:
rollout test "Test"
(
dropdownlist dd "dd" items:#("1","2","3","4","5","6","7","8","9","10") height:6
label l "L"
)
createDialog test 200 200
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
Rollout User-Interface Items Common Layout Parameters
Rollout User-Interface Control Types