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.
Applies to
ListBox and PictureListBox controls
Syntax
|
1 |
listboxname.SetState ( index, state ) |
|
Argument |
Description |
|---|---|
|
listboxname |
The name of the ListBox or PictureListBox in which you |
|
index |
The number of the item for which you want to set the |
|
state |
A boolean value that determines the state of the
|
Return value
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.SetState(6, TRUE) |
This statement deselects all items in lb_Actions:
|
1 |
lb_Actions.SetState(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 2 3 4 5 |
IF lb_Actions.State(6) = 1 THEN lb_Actions.SetState(6, FALSE) ELSE lb_Actions.SetState(6, TRUE) END IF |
See also