GetItem
The GetItem function opens a dialog showing a list of items in a list box. This function returns the index of the selected item and the button that was clicked. All labels can be configured. This is similar to the GetItemStr function except that it returns the index of the selected string and not the string itself.
|
List box is shown open with 4 choices. |
nIndex, bOK = GetItem( sLabels, n=nil, sPrompt=nil, sTitle=nil )
All arguments following sLabels are optional and assume default values after the last argument you specify. To use a default argument but follow it with a specified argument, use a nil in its place.
The items are specified as a single string using \n to separate the individual items. For example, to specify the labels as "First item" and "Second item", pass the sLabels argument as "First item\nSecond item".
The index of the choice is returned as nIndex, beginning at 1. If the User clicks [OK], then bOK=true. Otherwise, if the user clicks [Cancel], then bOK=false.
The window shown above was created using the following code. Note that the last 2 arguments, the prompt and the window title, were omitted and left to the defaults:
|
|
|
-- labels (4 lines concatenated by ..) |
|
-- initial choice |