Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

State – PB Docs 2019 – PowerBuilder Library

State – PB Docs 2019

State

PowerScript function

Description

Determines whether an item in a ListBox control is
highlighted.

Applies to

ListBox and PictureListBox controls

Syntax

Argument

Description

listboxname

The name of the ListBox or PictureListBox in which you
want to obtain the state (highlighted or not highlighted) of the
item identified by index

index

The number of the item for which you want to obtain the
state

Return value

Integer.

Returns 1 if the item in listboxname identified by index is
highlighted and 0 if it is not. If the index does not point to a valid
item number, State returns -1. If any argument’s value is null, State
returns null.

Usage

The State and SetState functions are meant for a ListBox that allows
multiple selections (its MultiSelect property is true). To find all of a
list’s selected items, loop through the list, checking the state of each
item.

The SelectedItem and SelectItem functions are meant for
single-selection ListBox controls. SelectedItem reports the selection
directly with no need for looping. In a multiple-selection ListBox
control, SelectedItem reports the first selected item only.

When you know the index of an item, you can use the Text function to
get the item’s text.

Examples

If item 3 in lb_Contact is selected (highlighted), then this example
sets li_Item to 1:

The following statements obtain the text of all the selected items
in a ListBox that allows the user to select more than one item. The
MessageBox function displays each item as it is found. You could include
other processing that created an array or list of the selected
values:

This statement executes some statements if item 3 in the ListBox
lb_Contact is highlighted:

See also

SelectedItem

SetState


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x