LISTBOX GET TEXT statement

Purpose

Retrieve the default text from a list box control.

Syntax

LISTBOX GET TEXT hDlg, id& TO txt$

Remarks

Retrieves the default (selected) text from the list box.

hDlg 

Handle of the dialog that owns the list box control.

id&

The unique control identifier assigned with the CONTROL ADD LISTBOX statement.

txt$

Selected text from the list box control is returned in this string.

Restrictions 

When used on a single-selection (standard) list box control, the LISTBOX GET TEXT statement returns the text of the item whose selection state is deemed as selected.

However, when used on a multiple-selection list box (the list box uses the %LBS_MULTIPLESEL or %LBS_EXTENDEDSEL styles), the LISTBOX GET TEXT statement only returns the text of the item that has the focus rectangle.

Note that, while that the focus rectangle in a list box, it may only be visible to the user when the list box control has keyboard focus. However, because list box controls keep track their own focus rectangle position at all times, the LISTBOX GET TEXT statement is able to return consistent results without needing to deal with keyboard focus at all.

Lastly, in a multiple-selection list box, the selection state of every item is tracked independently to the focus rectangle position in the list. This means that the selection state of any item in a list box cannot be determined through the LISTBOX GET TEXT result (whereas the selection state of a single-selection list box can be determined this way).

See also

Dynamic Dialog Tools, CONTROL ADD LISTBOX, CONTROL GET TEXT, LISTBOX ADD, LISTBOX DELETE, LISTBOX RESET,.LISTBOX SELECT