"selectedPos"

Selects a specific item from a list.

Synopsis

setValue(string shape, "selectedPos", int n);

getValue(string shape, "selectedPos", int &n);

shape.selectedPos(int n);

Parameters

Parameter Description
shape Name of the object
n Index of the selected field, starting with 1.
Note:

When "selectedPos" is called with the value 0, the last item from the list is selected.

SELECTION_LIST1.selectedPos(0);

Description

The parameter "n" is used to set or read the index of the selected option. For a getValue() function, the value -1 indicates that a list is empty.

Example

The following code example outputs the selected index and the associated text.

main()
{
  int cnt;
  shape list=getShape("selectionlist1");
  DebugN(list.selectedPos(), " ", list.selectedText());
}

Assignment

Selection list