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

ListBox.Insert

The ListBox Control Object that is returned by the AddListBox function has an Insert function. The Insert function can be used to add an entry to a specific position in the List Box.

Syntax

ControlObject.Insert (Index Number, Text)

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

Adds an option to a specific position in the List Box.

When you insert an option in a List Box, the options that appear below the new option in the list have their Index Numbers increased by 1. So, if you insert an option with an Index Number of 4, the option that previously had Index Number 4 will now have Index Number 5, the option that had Index Number 5 will have Index Number 6 and so on.

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).

 

Text {string}

The text that is shown for the option in the List Box.

Returns

Not applicable. The function does not return anything.

Example:

ListBox.Insert(2,"Point Alg1")

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 inserted option,
  • "Point Alg1" is the name of the option.

This means that the option will be placed below the options that have Index Number 0 and 1, but above the options that have Index Numbers of 3 or higher.


ClearSCADA 2015 R2