]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/choice.tex
sorting support for generic version (patch 1765087 from Bo)
[wxWidgets.git] / docs / latex / wx / choice.tex
CommitLineData
aa61d352
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: treectrl.tex
3%% Purpose: wxChoice documentation
4%% Author: wxWidgets Team
5%% Modified by:
6%% Created:
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets Team
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
a660d684
KB
12\section{\class{wxChoice}}\label{wxchoice}
13
14A choice item is used to select one of a list of strings. Unlike a
15listbox, only the selection is visible until the user pulls down the
16menu of choices.
17
18\wxheading{Derived from}
19
bed5584e 20\helpref{wxControlWithItems}{wxcontrolwithitems}\\
a660d684
KB
21\helpref{wxControl}{wxcontrol}\\
22\helpref{wxWindow}{wxwindow}\\
23\helpref{wxEvtHandler}{wxevthandler}\\
24\helpref{wxObject}{wxobject}
25
954b8ae6
JS
26\wxheading{Include files}
27
28<wx/choice.h>
29
a7af285d
VZ
30\wxheading{Library}
31
32\helpref{wxCore}{librarieslist}
33
a660d684
KB
34\wxheading{Window styles}
35
cb147822
VZ
36\begin{twocollist}\itemsep=0pt
37\twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries alphabetically.}
38\end{twocollist}
a660d684
KB
39
40See also \helpref{window styles overview}{windowstyles}.
41
5de76427
JS
42\wxheading{Event handling}
43
44\twocolwidtha{7cm}
45\begin{twocollist}\itemsep=0pt
46\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event,
47when an item on the list is selected.}
48\end{twocollist}
49
a660d684
KB
50\wxheading{See also}
51
5de76427
JS
52\helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox},
53\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
a660d684
KB
54
55\latexignore{\rtfignore{\wxheading{Members}}}
56
6ba93d23 57
f510b7b2 58\membersection{wxChoice::wxChoice}\label{wxchoicector}
a660d684
KB
59
60\func{}{wxChoice}{\void}
61
62Default constructor.
63
eaaa6a06 64\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
a660d684 65\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
eaaa6a06
JS
66\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
67\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
a660d684 68
56b88f12
MB
69\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
70\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
71\param{const wxArrayString\& }{choices},\rtfsp
72\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
73
a660d684
KB
74Constructor, creating and showing a choice.
75
76\wxheading{Parameters}
77
78\docparam{parent}{Parent window. Must not be NULL.}
79
80\docparam{id}{Window identifier. A value of -1 indicates a default value.}
81
82\docparam{pos}{Window position.}
83
84\docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized
85appropriately.}
86
87\docparam{n}{Number of strings with which to initialise the choice control.}
88
89\docparam{choices}{An array of strings with which to initialise the choice control.}
90
91\docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.}
92
93\docparam{validator}{Window validator.}
94
95\docparam{name}{Window name.}
96
97\wxheading{See also}
98
99\helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator}
100
c9110876
VS
101\pythonnote{The wxChoice constructor in wxPython reduces the {\tt n}
102and {\tt choices} arguments are to a single argument, which is
06d20283
RD
103a list of strings.}
104
5873607e
VZ
105\perlnote{In wxPerl there is just an array reference in place of {\tt n}
106and {\tt choices}.}
107
6ba93d23 108
f510b7b2 109\membersection{wxChoice::\destruct{wxChoice}}\label{wxchoicedtor}
a660d684
KB
110
111\func{}{\destruct{wxChoice}}{\void}
112
113Destructor, destroying the choice item.
114
6ba93d23 115
a660d684
KB
116\membersection{wxChoice::Create}\label{wxchoicecreate}
117
eaaa6a06 118\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
a660d684 119\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
eaaa6a06 120\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
f6e9a818
RN
121\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
122\param{const wxString\& }{name = ``choice"}}
a660d684 123
56b88f12
MB
124\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
125\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
126\param{const wxArrayString\& }{choices},\rtfsp
f6e9a818
RN
127\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
128\param{const wxString\& }{name = ``choice"}}
56b88f12 129
f510b7b2 130Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoicector}.
a660d684 131
6ba93d23 132
a660d684
KB
133\membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns}
134
135\constfunc{int}{GetColumns}{\void}
136
137Gets the number of columns in this choice item.
138
139\wxheading{Remarks}
140
bed5584e
VZ
141This is implemented for Motif only and always returns $1$ for the other
142platforms.
9c884972 143
6ba93d23
VZ
144
145\membersection{wxChoice::GetCurrentSelection}\label{wxchoicegetcurrentselection}
146
147\constfunc{int}{GetCurrentSelection}{\void}
148
149Unlike \helpref{GetSelection}{wxcontrolwithitemsgetselection} which only
150returns the accepted selection value, i.e. the selection in the control once
151the user closes the dropdown list, this function returns the current selection.
152That is, while the dropdown list is shown, it returns the currently selected
153item in it. When it is not shown, its result is the same as for the other
154function.
155
aa61d352 156\newsince{2.6.2} (before this version
6ba93d23
VZ
157\helpref{GetSelection}{wxcontrolwithitemsgetselection} itself behaved like
158this).
159
160
a660d684
KB
161\membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns}
162
eaaa6a06 163\func{void}{SetColumns}{\param{int}{ n = 1}}
a660d684
KB
164
165Sets the number of columns in this choice item.
166
167\wxheading{Parameters}
168
169\docparam{n}{Number of columns.}
170
171\wxheading{Remarks}
172
bed5584e
VZ
173This is implemented for Motif only and doesn't do anything under other
174platforms.
b67a86d5 175