Package Win32::GUI::Listbox

Back to the Packages


Constructor

new Win32::GUI::Listbox(PARENT, %OPTIONS)

Creates a new Listbox object; can also be called as PARENT->AddListbox(%OPTIONS). Class specific %OPTIONS are:

   -multisel => 0/1/2 (default 0)
       specifies the selection type:
           0 single selection
           1 multiple selection
           2 multiple selection ehnanced (with Shift, Control, etc.)
   -sort     => 0/1 (default 0)
       items are sorted alphabetically.


Methods

AddString(STRING)

Adds an item at the end of the Listbox.

Clear()

See Reset().

Count()

Returns the number of items in the Listbox.

FindString(STRING, [INDEX])

Searches the Listbox for an item that begins with the specified STRING. The optional INDEX parameter tells to start the search from the specified position; if no parameter is given, the whole list is searched. Returns the zero-based index of the found item or -1 if no matching item was found.

FindStringExact(STRING, [INDEX])

Searches the Listbox for an item that exactly matches the specified STRING (case insensitively). The optional INDEX parameter tells to start the search from the specified position; if no parameter is given, the whole list is searched. Returns the zero-based index of the found item or -1 if no matching item was found.

FirstVisibleItem([INDEX])

Gets the zero-based index of the first visible item in the Listbox, or sets it to the specified INDEX.

GetString(INDEX)

Returns the string at the specified zero-based INDEX in the Listbox.

InsertItem(STRING, [INDEX])

Inserts an item at the specified zero-based INDEX in the Listbox, or adds it at the end if INDEX is not specified.

ItemFromPoint(X, Y)

Returns the zero-based index of the item nearest to the specified point; if called in a list context, returns an additional element which is TRUE if the point is inside the Listbox area, FALSE if it's outside.

ItemHeight([HEIGHT])

Gets or sets the items height in a Listbox.

ListIndex()

See SelectedItem().

RemoveItem(INDEX)

Removes the zero-based INDEX item from the Listbox.

Reset()

Deletes the content of the Listbox.

Select(INDEX)

Selects the zero-based INDEX item in the Listbox.

SelectCount()

Returns the number of selected items in a multiple selection Listbox.

SelectedItem()

Returns the zero-based index of the currently selected item, or -1 if no item is selected.

SelectedItems()

Returns an array containing the zero-based indexes of the selected items in a multiple selection Listbox.

SelectString(STRING, [INDEX])

Searches the Listbox for an item that begins with the specified STRING and, if found, selects that item. The optional INDEX parameter tells to start the search from the specified position; if no parameter is given, the whole list is searched. Returns the zero-based index of the selected item or -1 if no matching item was found.


Events

Click()

[TBD]

DblClick()

Sent when the user double clicks on the control.

GotFocus()

Sent when the control is activated.

LostFocus()

Sent when the control is deactivated.