A list box is used to select one or more of a list of strings. The strings are displayed in a scrolling box, with the selected string(s) marked in reverse video. A list item can be single selection (if an item is selected, the previous selection is removed) or multiple selection (clicking an item toggles the item on or off independently of other selections).
wxListBox::wxListBox
voidwxListBoxwxPanel *parent, wxFunction func,
char *label,
Bool multiple_selection = FALSE, int x = -1, int y = -1,
int width = -1, int height = -1, int n, char *choices[]
Constructor, creating and showing a list box. If width or height are omitted (or are less than zero), an appropriate size will be used for the list box. func may be NULL; otherwise it is used as the callback for the list box. Note that the cast (wxFunction) must be used when passing your callback function name, or the compiler may complain that the function does not match the constructor declaration.
n is the number of possible choices, and choices is an array of strings of size n. wxWindows allocates its own memory for these strings so the calling program must deallocate the array itself.
multiple_selection is TRUE for a multiple selection list box, FALSE for a single selection list box.
wxListBox::wxListBox
voidwxListBox
Destructor, destroying the list box.
wxListBox::Append
voidAppendchar * item
Adds the item to the end of the list box. item must be deallocated by the calling program, i.e. wxWindows makes its own copy.
voidAppendchar * item, char *client_data
Adds the item to the end of the list box, associating the given data with the item. item must be deallocated by the calling program.
wxListBox::Clear
voidClear
Clears all strings from the list box.
wxListBox::GetClientData
char *GetClientDataint n
Returns a pointer to the client data associated with the given item (if any).
wxListBox::Deselect
voidDeselectint n
Deselects the given item in the list box.
wxListBox::FindString
intFindStringint char *s
Finds a choice matching the given string, returning the position if found, or -1 if not found.
wxListBox::GetSelection
intGetSelection
Gets the id (position) of the selected string - for single selection list boxes only.
wxListBox::GetSelections
intGetSelectionsint **selections
Gets an array containing the positions of the selected strings. The number of selections is returned. Pass a pointer to an integer array, and do not deallocate the returned array.
wxListBox::GetStringSelection
char *GetStringSelection
Gets the selected string - for single selection list boxes only. This must be copied by the calling program if long term use is to be made of it.
wxListBox::Set
voidSetint n, char *choices[]
Clears the list box and adds the given strings. Deallocate the array from the calling program after this function has been called.
wxListBox::SetSelection
voidSetSelectionint n
Sets the choice by passing the desired string position.
wxListBox::SetStringSelection
voidSetStringSelectionchar * s
Sets the choice by passing the desired string.
wxListBox::String
char *Stringint n
Returns a temporary pointer to the string at position n.