"currentIndex"

Returns or sets the current item in the combo box. The function is similar to "selectedPos()" but uses the index of an item for selection instead of a position.

Synopsis

setValue( string shape, "currentIndex", int idx);

getValue(string shape, "currentIndex", int &idx);

shape.currentIndex(int idx);

Parameters

Parameter Description
shape Name of the object
idx Index of the selected item, starting with 0

Description

The selected item can be set or read with this function. The first item starts at the index 0.

If no item is selected or the combo box does not contain any items, the index is -1.

This function offers a differing functionality from "selectedPos()" by triggering the "changed()" script of the combo box after the item is changed.

Example

The following example sets the currently selected index to the first position and then displays this setting in the debug.

main()
{
  COMBO_BOX1.currentIndex(0);
  DebugTN("1st item index", COMBO_BOX1.currentIndex);
}

Assignment

Combo box