You are here: Core Reference > Coding > Scripting > ListBox.SetSelected

ListBox.SetSelected

The ListBox Control Object that is returned by the AddListBox function has a SetSelected function. The SetSelected function can be used to set specific entries to be selected by default when the Form is displayed.

Syntax

ControlObject.SetSelected (Index Number, Value)

Where ControlObject. is the name of the variable (declared in your script) that is used to store the List Box Control Object that is returned by the AddListBox function.

Description

Use to set specific entries to be selected by default when the Form is displayed.

If the Multiple property is False, you cannot use the SetSelected property. You can use the Selection property instead. ListBox.Selection

Arguments

Index Number {integer}

A number that corresponds to the position of the option in the List Box (descending order with 0 at the top and the highest number at the bottom of the List Box).

 

Value {Boolean}

If set to True (1), the selected option is set to be selected when the Form is displayed; if set to False (0), the selected option is not selected when the Form is displayed.

Returns

Not applicable. The function does not return anything.

Example:

ListBox.SetSelected(2,TRUE)

Where:

  • ListBox is the name of the variable used to store the List Box Control Object that is returned by the AddListBox function (which would be defined earlier in the script)
  • 2 is the Index Number for the option being set
  • TRUE is the boolean that sets the option to be selected by default when the Form is displayed.

ClearSCADA 2015 R2