OPTIONLIST

Concept Link IconSee also Concept Link IconExample

Access properties of the Option-button list form control.

Partial WebVue support - See the table with the list of modes below. Not supported modes return an unsuccessful code if used in this context.

Mode Mnemonic Syntax WebVue support
1 COUNT 1 Yes
2 GETSELECTEDINDEX 1 Yes
3 SETSELECTEDINDEX 2 Yes
4 GETTEXT 4 Yes
5 GETUSERDATA 4 Yes
6 GETSTATE 7 Yes
7 SETSTATE 3 Yes
8 LOAD 5 Yes
9 GETEVENTTYPE 1 Yes
10 GETOPTION 1 Yes
11 SETOPTION 2 Yes
12 INSERT 6 Yes
13 REMOVE 7 Yes
14 SORT 8 No
15 CLEAR 1 No
16 SETTEXT 9 No
17 SETUSERDATA 9 No
18 SAVE 5 No

An important note about the terminology used and operation of the Option List control in PcVue.

  • The item that is SET is the one in which the center of the corresponding circle is filled.

  • The item that is SELECTED is the one whose text is highlighted (by changing its background color)

An item that is SET is not necessarily SELECTED (and vice versa). Programmatically you are normally only interested in which item is SET. The item that is SELECTED has little meaning.

For more information on the behavior of the Option List Control, see PcVue main help.

Arguments common to more than one mode

Argument

Meaning

Window The name of the window that contains the form control. Type STR.
Branch The branch (if any) of the window. Use "*" to indicate the current branch of the program. Type STR.
Identity The identity of the form control within the specified window. Type STR.
Index The index of the item to select. Type LONG.
Notify

To indicate whether the action triggers the execution of the SCADA Basic function defined in the Operations configuration of the form control. Type INTEGER.

Syntax 1

LongVal = OPTIONLIST(Mode, Window, Branch, Identity);

Return type: LONG.

Execution

Mode

Mnemonic

Action

1

COUNT

Returns the number of items.

2

GETSELECTEDINDEX

Returns the index of the item currently selected.
9 GETEVENTTYPE

Returns the type of the most recent event.

The return is binary weighted value.
Bit 0: The selection has been changed.
Bit 1: An item's state has been changed.

10 GETOPTION

Return the index of the item that is set. If no item is set then -1 is returned.

 

15 CLEAR

Clears the list contents and any selection.

Return: 1 if successful.

    Return: 0 if unsuccessful.

Syntax 2

LongVal = OPTIONLIST(Mode, Window, Branch, Identity, Index[, Notify]);

Return type: LONG.

Execution

Mode

Mnemonic

Action

3

SETSELECTEDINDEX

Select an item according to the value of the argument Index. If the Index is -1 then no item is selected. The function will scroll the control if necessary to display the item.

Return: 1 if successful.

11 SETOPTION

Sets the item corresponding to the supplied index. The function will scroll the control if necessary to display the item.

Return: The index of the item set or -1 if no item is checked.

    Return: 0 if unsuccessful.

Syntax 3

LongVal = OPTIONLIST(Mode, Window, Branch, Identity, Index, State[, Notify]);

Return type: LONG.

Argument

Meaning

State State to be set. The value can be 0 or 1. Type INTEGER

Execution

Mode

Mnemonic

Action

7 SETSTATE

Sets the state of the item corresponding to the supplied index. The function will scroll the control if necessary to display the item.

Return: 1 if successful, else 0.

Syntax 4

StrVal = OPTIONLIST(Mode, Window, Branch, Identity, Index);

Return type: STR.

Execution

Mode

Mnemonic

Action

4 GETTEXT Returns the Text of the item at Index as defined for the language currently in use.
5 GETUSERDATA Returns the User Data associated with the item at Index.

Syntax 5

LongVal = OPTIONLIST(Mode, Window, Branch, Identity, FileName);

Return type: LONG.

Argument

Meaning

FileName

The name of the file that contains the form control's data.

Execution

Mode

Mnemonic

Action

8

LOAD

Loads the file's content into the form control's list of items.

Return: 1 if successful (file loaded and form control populated), else 0.

18 SAVE

Save the form control's list of items in a file. The form control's source must be set to File or the instruction will fail.

Return: 1 if successful (items saved in file), else 0.

Syntax 6

LongVal = OPTIONLIST(Mode, Window, Branch, Identity, Text, Userdata, [Index])

Return type: LONG.

Argument

Meaning

Text The text to insert. Type STR.
Userdata The user data to insert. Type STR.
Index The index of an item in the form control. Type LONG.

Execution

Mode

Mnemonic

Action

12

INSERT

Inserts a new item with the Text and optional Userdata in the form control list. If Index is omitted, the item is inserted at the end. Otherwise, the item is inserted at the position indicated by Index, starting at 0 for the first item.
Return: 1 if successful, else 0.

Syntax 7

LongVal = OPTIONLIST(Mode, Window, Branch, Identity, Index);

Return type: LONG.

Execution

Mode

Mnemonic

Action

6 GETSTATE Returns the state of the item (set or not).

13

REMOVE

Removes the item at Indexfrom the form control.
Return: 1 if successful, else 0.

Syntax 8

LongVal = OPTIONLIST(Mode, Window, Branch, Identity[, Sortorder, Orderby]);

Return type: LONG.

Argument

Meaning

Sortorder A flag indication the sort order. 0 = ascending, 1 = descending
Orderby A flag selecting which data to sort by. 0 = Text, 1 = User data.

Execution

Mode

Mnemonic

Action

14

SORT

Sort the form control list using the specified criteria.
Return: 1 if successful, else 0.

Syntax 9

LongVal = OPTIONLIST(Mode, Window, Branch, Identity[, Index, StrVal]);

Return type: LONG.

Argument

Meaning

StrVal The string value to set.

Execution

Mode

Mnemonic

Action

16 SETTEXT Sets the text of the item at Index with value StrVal.
17 SETUSERDATA Sets the user data associated to the item at Index with value StrVal.
    Return: 1 if successful, else 0.

Example

For an example, select the Example link above.