Equinox Online Help - Language Reference - A to Z

Home

PickList

Applies to
SyntaxPickList (OptionsExpression [, SwitchExpression])
Action[Function] Presents you with a list of options from which to choose.
ScopeUsable anywhere.
Notes

This function creates a dialog displaying a list of options. You are prompted to select one of the items from the list. OptionsExpression contains the options that appear in the list and is a string which has the following format.

"/option 1/option 2/option 3 ..."

The first character (forward slash) is the separator for each option. The optional argument, SwitchExpression, specifies whether or not buttons appear on the dialog. If SwitchExpression evaluates to True, OK and Cancel buttons appear on the dialog. If it is False, then no buttons appear. If omitted, SwitchExpression defaults to False.

When you select an option, it is returned (as a string). The function also sets the system workarea SysResult to the number of items selected, and SysReply to one of the following values:

  • > 0 Value returned (as normal)
  • -1 User pressed the Escape key, or chose the Cancel button
  • -2 No response (timeout error)
  • -3 Undefined error

NOTES: If the number of items in the picklist drop down is less than 4, the scroll bar will not appear, even if it is configured to appear in the PopUpFlags statement.

A pickList can be made multi-selectable by the use of the PopUpFlags 64 statement. The data collected can be manipulated with the PickListSelection statement.

CategoryPick lists
See Also Pick_PickRecord, PickCaptions, PickColumnWidths, PickFields, PickListSelection, PickRange_PickRecordRange, PickSelection, PickWrite_PickRecordWrite
Example

This method (attached to a Before Field event on a form) allows the user to select a value for the field. The user selects a value from the list and the input focus is moved to the age field.

string s

repeat
s = PickList("/Male/Female/Unknown", False)
until SysReply <> -1

ChangeObject "age"

This example demonstrates how to enable multi-selectable lists and how to manipulate the data selected:

number iIndex, iSelections
string s

repeat
PopupColour 4, 5, 6, 7
PopupTitle "Select A Number"
PopupFlags 64
s = PickList("/One/Two/Three/4/5/6/7", True)
until SysReply <> -1

| Note no. of multiple selections
iSelections = SysResult
iIndex = 0

| Multiple selections ?
if iSelections > 0 then
iIndex = 1
print "There were <" & iSelections & "> selections made"

| Troll through list of selections
While iIndex < iSelections + 1
PickListSelection iIndex, s
print "Selection " & iIndex & " - <" & s & ">, Original Index - <" & SysReply & ">"
iIndex = iIndex + 1
end while
end if