X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/06d20283afba5439c8a2c1b3b7cd3390541da52d..44cf9b50eef370cc94a6c1f249693dee3776d619:/docs/latex/wx/listbox.tex diff --git a/docs/latex/wx/listbox.tex b/docs/latex/wx/listbox.tex index c34798f130..fe981c44f2 100644 --- a/docs/latex/wx/listbox.tex +++ b/docs/latex/wx/listbox.tex @@ -7,13 +7,15 @@ is selected, the previous selection is removed) or multiple selection (clicking an item toggles the item on or off independently of other selections). -List box elements are numbered from zero. +List box elements are numbered from zero. Their number is limited in +some platforms (e.g. ca. 2000 on GTK). A listbox callback gets an event wxEVT\_COMMAND\_LISTBOX\_SELECT for single clicks, and wxEVT\_COMMAND\_LISTBOX\_DOUBLE\_CLICKED for double clicks. \wxheading{Derived from} +\helpref{wxControlWithItems}{wxcontrolwithitems}\\ \helpref{wxControl}{wxcontrol}\\ \helpref{wxWindow}{wxwindow}\\ \helpref{wxEvtHandler}{wxevthandler}\\ @@ -38,6 +40,10 @@ select multiple items using the SHIFT key and the mouse or special key combinati \twocolitem{\windowstyle{wxLB\_SORT}}{The listbox contents are sorted in alphabetical order.} \end{twocollist} +Note that {\tt wxLB\_SINGLE}, {\tt wxLB\_MULTIPLE} and {\tt wxLB\_EXTENDED} +styles are mutually exclusive and you can specify at most one of them (single +selection is the default). + See also \helpref{window styles overview}{windowstyles}. \wxheading{Event handling} @@ -47,7 +53,7 @@ See also \helpref{window styles overview}{windowstyles}. \twocolitem{{\bf EVT\_LISTBOX(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_SELECTED event, when an item on the list is selected.} \twocolitem{{\bf EVT\_LISTBOX\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_DOUBLECLICKED event, -when the listbox is doubleclicked.} +when the listbox is double-clicked.} \end{twocollist} \wxheading{See also} @@ -95,11 +101,12 @@ appropriately.} \helpref{wxListBox::Create}{wxlistboxcreate}, \helpref{wxValidator}{wxvalidator} -\pythonnote{The wxListBox constructor in wxPython reduces the \tt{n} -and \tt{choices} arguments are to a single argument, which is +\pythonnote{The wxListBox constructor in wxPython reduces the {\tt n} +and {\tt choices} arguments are to a single argument, which is a list of strings.} - +\perlnote{In wxPerl there is just an array reference in place of {\tt n} +and {\tt choices}.} \membersection{wxListBox::\destruct{wxListBox}} @@ -107,29 +114,6 @@ a list of strings.} Destructor, destroying the list box. -\membersection{wxListBox::Append}\label{wxlistboxappend} - -\func{void}{Append}{\param{const wxString\& }{ item}} - -Adds the item to the end of the list box. - -\func{void}{Append}{\param{const wxString\& }{ item}, \param{char* }{clientData}} - -Adds the item to the end of the list box, associating the given data -with the item. - -\wxheading{Parameters} - -\docparam{item}{String to add.} - -\docparam{clientData}{Client data to associate with the item.} - -\membersection{wxListBox::Clear}\label{wxlistboxclear} - -\func{void}{Clear}{\void} - -Clears all strings from the list box. - \membersection{wxListBox::Create}\label{wxlistboxcreate} \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp @@ -140,16 +124,6 @@ Clears all strings from the list box. Creates the listbox for two-step construction. See \helpref{wxListBox::wxListBox}{wxlistboxconstr}\rtfsp for further details. -\membersection{wxListBox::Delete}\label{wxlistboxdelete} - -\func{void}{Delete}{\param{int}{ n}} - -Deletes an item from the listbox. - -\wxheading{Parameters} - -\docparam{n}{The zero-based item index.} - \membersection{wxListBox::Deselect}\label{wxlistboxdeselect} \func{void}{Deselect}{\param{int}{ n}} @@ -164,64 +138,15 @@ Deselects an item in the list box. This applies to multiple selection listboxes only. -\membersection{wxListBox::FindString}\label{wxlistboxfindstring} - -\func{int}{FindString}{\param{const wxString\& }{string}} - -Finds an item matching the given string. - -\wxheading{Parameters} - -\docparam{string}{String to find.} - -\wxheading{Return value} - -The zero-based position of the item, or -1 if the string was not found. - -\membersection{wxListBox::GetClientData}\label{wxlistboxgetclientdata} - -\constfunc{char*}{GetClientData}{\param{int}{ n}} - -Returns a pointer to the client data associated with the given item (if any). - -\wxheading{Parameters} - -\docparam{n}{The zero-based position of the item.} - -\wxheading{Return value} - -A pointer to the client data, or NULL if not present. - -\membersection{wxListBox::GetSelection}\label{wxlistboxgetselection} - -\constfunc{int}{GetSelection}{\void} - -Gets the position of the selected item. - -\wxheading{Return value} - -The position of the current selection. - -\wxheading{Remarks} - -Applicable to single selection list boxes only. - -\wxheading{See also} - -\helpref{wxListBox::SetSelection}{wxlistboxsetselection},\rtfsp -\helpref{wxListBox::GetStringSelection}{wxlistboxgetstringselection},\rtfsp -\helpref{wxListBox::GetSelections}{wxlistboxgetselections} - \membersection{wxListBox::GetSelections}\label{wxlistboxgetselections} -\constfunc{int}{GetSelections}{\param{int **}{selections}} +\constfunc{int}{GetSelections}{\param{wxArrayInt\& }{selections}} -Gets an array containing the positions of the selected strings. +Fill an array of ints with the positions of the currently selected items. \wxheading{Parameters} -\docparam{selections}{A pointer to an integer array, which will be allocated by the function if -selects are present. Do not deallocate the returned array - it will be deallocated by the listbox.} +\docparam{selections}{A reference to an wxArrayInt instance that is used to store the result of the query.} \wxheading{Return value} @@ -233,43 +158,36 @@ Use this with a multiple selection listbox. \wxheading{See also} -\helpref{wxListBox::GetSelection}{wxlistboxgetselection},\rtfsp -\helpref{wxListBox::GetStringSelection}{wxlistboxgetstringselection},\rtfsp -\helpref{wxListBox::SetSelection}{wxlistboxsetselection} - -\membersection{wxListBox::GetString}\label{wxlistboxgetstring} +\helpref{wxControlWithItems::GetSelection}{wxcontrolwithitemsgetselection},\rtfsp +\helpref{wxControlWithItems::GetStringSelection}{wxcontrolwithitemsgetstringselection},\rtfsp +\helpref{wxControlWithItems::SetSelection}{wxcontrolwithitemssetselection} -\constfunc{wxString}{GetString}{\param{int}{ n}} +\pythonnote{The wxPython version of this method takes no parameters +and returns a tuple of the selected items.} -Returns the string at the given position. +\perlnote{In wxPerl this method takes no parameters and return the +selected items as a list.} -\wxheading{Parameters} - -\docparam{n}{The zero-based position.} - -\wxheading{Return value} +\membersection{wxListBox::InsertItems}\label{wxlistboxinsertitems} -The string, or an empty string if the position was invalid. +\func{void}{InsertItems}{\param{int}{ nItems}, \param{const wxString}{ *items}, \param{int}{ pos}} -\membersection{wxListBox::GetStringSelection}\label{wxlistboxgetstringselection} +Insert the given number of strings before the specified position. -\constfunc{wxString}{GetStringSelection}{\void} +\wxheading{Parameters} -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. +\docparam{nItems}{Number of items in the array {\it items}} -\wxheading{See also} +\docparam{items}{Labels of items to be inserted} -\helpref{wxListBox::GetSelection}{wxlistboxgetselection},\rtfsp -\helpref{wxListBox::GetSelections}{wxlistboxgetselections},\rtfsp -\helpref{wxListBox::SetSelection}{wxlistboxsetselection} +\docparam{pos}{Position before which to insert the items: for example, if {\it pos} is 0 the items +will be inserted in the beginning of the listbox} -\membersection{wxListBox::Number}\label{wxlistboxnumber} +\pythonnote{The first two parameters are collapsed into a single +parameter for wxPython, which is a list of strings.} -\constfunc{int}{Number}{\void} - -Returns the number of items in the listbox. +\perlnote{In wxPerl there is just an array reference in place of {\tt nItems} +and {\tt items}.} \membersection{wxListBox::Selected}\label{wxlistboxselected} @@ -283,13 +201,15 @@ Determines whether an item is selected. \wxheading{Return value} -TRUE if the given item is selected, FALSE otherwise. +true if the given item is selected, false otherwise. \membersection{wxListBox::Set}\label{wxlistboxset} -\func{void}{Set}{\param{int}{ n}, \param{const wxString*}{ choices}} +\func{void}{Set}{\param{int}{ n}, \param{const wxString*}{ choices}, \param{void}{ **clientData = {\tt NULL}}} + +\func{void}{Set}{\param{const wxArrayString\&}{ choices}, \param{void}{ **clientData = {\tt NULL}}} -Clears the list box and adds the given strings. +Clears the list box and adds the given strings to it. \wxheading{Parameters} @@ -297,22 +217,12 @@ Clears the list box and adds the given strings. \docparam{choices}{An array of strings to set.} -\wxheading{Remarks} - -Deallocate the array from the calling program -after this function has been called. - -\membersection{wxListBox::SetClientData}\label{wxlistboxsetclientdata} - -\func{void}{SetClientData}{\param{int}{ n}, \param{char* }{data}} +\docparam{clientData}{Options array of client data pointers} -Associates the given client data pointer with the given item. - -\wxheading{Parameters} - -\docparam{n}{The zero-based item index.} +\wxheading{Remarks} -\docparam{data}{The client data to associate with the item.} +You may free the array from the calling program after this function has been +called. \membersection{wxListBox::SetFirstItem}\label{wxlistboxsetfirstitem} @@ -320,7 +230,7 @@ Associates the given client data pointer with the given item. \func{void}{SetFirstItem}{\param{const wxString\& }{string}} -Set the specified item to be the first visible item. +Set the specified item to be the first visible item. Windows only. \wxheading{Parameters} @@ -328,39 +238,3 @@ Set the specified item to be the first visible item. \docparam{string}{The string that should be visible.} -\membersection{wxListBox::SetSelection}\label{wxlistboxsetselection} - -\func{void}{SetSelection}{\param{int}{ n}, \param{const bool }{select = TRUE}} - -Selects or deselects the given item. - -\wxheading{Parameters} - -\docparam{n}{The zero-based item index.} - -\docparam{select}{If TRUE, will select the item. If FALSE, will deselect it.} - -\membersection{wxListBox::SetString}\label{wxlistboxsetstring} - -\func{void}{SetString}{\param{int}{ n}, \param{const wxString\& }{ string}} - -Sets the string value of an item. - -\wxheading{Parameters} - -\docparam{n}{The zero-based item index.} - -\docparam{string}{The string to set.} - -\membersection{wxListBox::SetStringSelection}\label{wxlistboxsetstringselection} - -\func{void}{SetStringSelection}{\param{const wxString\& }{ string}, \param{const bool}{ select = TRUE}} - -Sets the current selection. - -\wxheading{Parameters} - -\docparam{string}{The item to select.} - -\docparam{select}{If TRUE, will select the item. If FALSE, will deselect it.} -