SetState PowerScript function
Description
Sets the highlighted state of an item in a list box. SetState is
only applicable to a list box control whose MultiSelect property
is set to true.
Controls
ListBox and PictureListBox controls
Syntax
1 |
<span>listboxname</span>.<span>SetState</span> ( <span>index</span>, <span>state</span> ) |
Argument |
Description |
---|---|
listboxname |
The name of the ListBox or PictureListBox |
index |
The number of the item for which you |
state |
A boolean value that determines the state
|
Return Values
Integer. Returns 1 if it succeeds and
-1 if an error occurs. If any argument’s value is null, SetState returns null.
Usage
When the MultiSelect property for the control is false,
use SelectItem, instead of SetState,
to select one item at a time.
Examples
This statement turns on the highlight for item 6
in lb_Actions:
1 |
lb_Actions.<span>SetState</span>(6, TRUE) |
This statement deselects all items in lb_Actions:
1 |
lb_Actions.<span>SetState</span>(0, FALSE) |
This statement turns off the highlight for item 6
in lb_Actions if it is selected and
turns it on again if it is not selected:
1 |
IF lb_Actions.<span>State</span>(6) = 1 THEN |
1 |
lb_Actions.<span>SetState</span>(6, FALSE) |
1 |
ELSE |
1 |
lb_Actions.<span>SetState</span>(6, TRUE) |
1 |
END IF |