GetItemStr
The GetItemStr function opens a dialog showing a list of items in a list box. This function returns the string for the selected item plus the button that was clicked. All labels can be configured. This is similar to the GetItem function except that it returns the selected string and not its index.
|
List box shown opened with 4 choices. |
sItem, bOK = GetItemStr( sLabels )
sItem, bOK = GetItemStr( sLabels, n )
sItem, bOK = GetItemStr( sLabels, n, sPrompt )
sItem, bOK = GetItemStr( sLabels, n, sPrompt, sTitle )
sLabels is a string containing the list of item labels, separated by \n.
n is the index of the initial choice, beginning with item 1. if nil, then item 1 is initially chosen.
sPrompt is the message above the list box. If nil, a default prompt is used.
sTitle is the window title. If nil, a default title is used.
If [OK] is clicked, the function returns the selected string sItem and bOK = true.
If the dialog is canceled, "", false is returned.
All arguments following sLabels are optional and assume default values beyond 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 choice is returned as a string in sItem. 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:
|
|
|
-- the labels (concatenated) |
|
-- initial choice |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.