.\" This is a wxWidgets manpage page generated from the XML docs .TH wxControlWithItems 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxControlWithItems \- .SH DESCRIPTION This class is an abstract base class for some wxWidgets controls which contain several items, such as wxListBox and wxCheckListBox derived from it, wxChoice and wxComboBox . It defines the methods for accessing the controls items and although each of the derived classes implements them differently, they still all conform to the same interface. The items in a wxControlWithItems have (non empty) string labels and, optionally, client data associated with them. Client data may be of two different kinds: either simple untyped ( void * ) pointers which are simply stored by the control but not used in any way by it, or typed pointers ( wxClientData * ) which are owned by the control meaning that the typed client data (and only it) will be deleted when an item is deleted or the entire control is cleared (which also happens when it is destroyed). Finally note that in the same control all items must have client data of the same type (typed or untyped), if any. This type is determined by the first call to Append (the version with client data pointer) or SetClientData . .SH "PARENTS" wxControl wxWindow wxEvtHandler wxObject .SH "INCLUDE FILES" wx/ctrlsub.hbut usually never included directly .SH MEMBERS .SS int Append (const wxString& item) Adds the item to the end of the list box. .SS int Append (const wxString& itemvoid *clientData) .SS int Append (const wxString& itemwxClientData *clientData) Adds the item to the end of the list box, associating the given, typed or untyped, client data pointer with the item. .SS void Append (const wxArrayString& strings) Appends several items at once to the control. Notice that calling this method may be much faster than appending the items one by one if you need to add a lot of items. .SS void Clear () Removes all items from the control. Clear() also deletes the client data of the existing items if it is owned by the control. .SS void Delete (int n) Deletes an item from the control. The client data associated with the item will be also deleted if it is owned by the control. Note that it is an error (signalled by an assert failure in debug builds) to remove an item with the index negative or greater or equal than the number of items in the control. .SS int FindString (const wxString& stringbool caseSensitive = false) Finds an item whose label matches the given string. .SS void * GetClientData (int n) Returns a pointer to the client data associated with the given item (if any). It is an error to call this function for a control which doesn't have untyped client data at all although it is ok to call it even if the given item doesn't have any client data associated with it (but other items do). .SS wxClientData * GetClientObject (int n) Returns a pointer to the client data associated with the given item (if any). It is an error to call this function for a control which doesn't have typed client data at all although it is ok to call it even if the given item doesn't have any client data associated with it (but other items do). .SS int GetCount () Returns the number of items in the control. .SS int GetSelection () Returns the index of the selected item or wxNOT_FOUND if no item is selected. .SS wxString GetString (int n) Returns the label of the item with the given index. .SS wxString GetStringSelection () Returns the label of the selected item or an empty string if no item is selected. .SS int Insert (const wxString& itemint pos) Inserts the item into the list before pos. Not valid for wxLB_SORT or wxCB_SORT styles, use Append instead. .SS int Insert (const wxString& itemint posvoid *clientData) .SS int Insert (const wxString& itemint poswxClientData *clientData) Inserts the item into the list before pos, associating the given, typed or untyped, client data pointer with the item. Not valid for wxLB_SORT or wxCB_SORT styles, use Append instead. .SS bool IsEmpty () Returns true if the control is empty or false if it has some items. .SS int Number () Obsolescence note: This method is obsolete and was replaced with GetCount , please use the new method in the new code. This method is only available if wxWidgets was compiled with WXWIN_COMPATIBILITY_2_2 defined and will disappear completely in future versions. .SS void Select (int n) This is the same as SetSelection and exists only because it is slightly more natural for controls which support multiple selection. .SS void SetClientData (int nvoid *data) Associates the given untyped client data pointer with the given item. Note that it is an error to call this function if any typed client data pointers had been associated with the control items before. .SS void SetClientObject (int nwxClientData *data) Associates the given typed client data pointer with the given item: the data object will be deleted when the item is deleted (either explicitly by using Deletes or implicitly when the control itself is destroyed). Note that it is an error to call this function if any untyped client data pointers had been associated with the control items before. .SS void SetSelection (int n) Sets the selection to the given item n or removes the selection entirely if n == wxNOT_FOUND . Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections. .SS void SetString (int nconst wxString& string) Sets the label for the given item. .SS bool SetStringSelection (const wxString& string) Selects the item with the specified string in the control. This doesn't cause any command events being emitted. .SH "SEE ALSO" wxControl wxWindow wxEvtHandler wxObject .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.