ListBox

Object List Hierarchy Next Object

Definition:

Displays a list of items that a user can select. If the number of items in the list exceeds the box's boundaries, a vertical scroll bar is automatically added.

Icon: images/Phx00179.gif

Specialized Features:

The following tables list and describe the properties, methods, and events added by ListBox.


Properties Use to...


Ctrl3d Enable the 3-D effects for the Control.

ItemHeight Determine the height of a single item. (Read only)

ListCount Specify the number of items in the list portion of the control.

ListIndex Return the index number of the currently selected item in a control.

MultiSelect Determine whether the list box is a single-selection or multi-selection list.

SelCount Give the number of items currently selected in a list.

Sorted Determine whether the elements of a ComboBox, ListBox, or FileListBox are sorted alphabetically by Phoenix.

Text Determine the selected item in the list box for FileListBoxes and ComboBoxes with a Style value of 2 - DropDown List.


Methods Use to...


AddItem Add a new item to a ComboBox, ListBox, or FileListBox.

Clear Clear the contents of a ListBox, ComboBox, or FileListBox.

FindIndexUnderPoint Find the index of the item in the list that is beneath an x-y coordinate.

FindString
Locate the requested string prefix in the ListBox.

InsertItem Insert a new item at a given index.

ItemIndex Find the index of a given string.

List Find the string at a given index.

RemoveItem Remove a specified item from a ListBox, ComboBox, or FileListBox.

Selected Return TRUE if the list item at the given index is selected, FALSE if it is not selected or if the list index is invalid.

SetSelected Change the selection state of the item at the given index according to the value of the "sel" parameter.


Events Use to...


Click Perform an action when the user presses and releases a mouse button while on an object, or when the value of a control is changed in code.

DblClick Perform an action when the user presses and releases a mouse button twice in rapid succession over an object.

GotFocus Define what occurs when an object is given the focus.

KeyDown Define what occurs when the user presses a key while an object has the focus.

KeyPress Define what occurs when the user presses and releases an ANSI key.

KeyUp Define what occurs when the user releases a key while an object has the focus.

LostFocus Define what occurs when an object loses the focus.

Copied Features:

images/Phx00180.gif Properties images/Phx00181.gif Methods images/Phx00182.gif Events

Details:

To select one or more list items, highlight it by using the arrow keys or by clicking on it. To add or delete items in a list, use the AddItem or RemoveItem methods.

Setting the ListCount and ListIndex properties provides a user with a method for accessing specific list items. Use the Clear method to completely remove any text contained in the list box.