]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/choice.tex
New drawing test code.
[wxWidgets.git] / docs / latex / wx / choice.tex
... / ...
CommitLineData
1\section{\class{wxChoice}}\label{wxchoice}
2
3A choice item is used to select one of a list of strings. Unlike a
4listbox, only the selection is visible until the user pulls down the
5menu of choices.
6
7\wxheading{Derived from}
8
9\helpref{wxControl}{wxcontrol}\\
10\helpref{wxWindow}{wxwindow}\\
11\helpref{wxEvtHandler}{wxevthandler}\\
12\helpref{wxObject}{wxobject}
13
14\wxheading{Include files}
15
16<wx/choice.h>
17
18\wxheading{Window styles}
19
20There are no special styles for wxChoice.
21
22See also \helpref{window styles overview}{windowstyles}.
23
24\wxheading{Event handling}
25
26\twocolwidtha{7cm}
27\begin{twocollist}\itemsep=0pt
28\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event,
29when an item on the list is selected.}
30\end{twocollist}
31
32\wxheading{See also}
33
34\helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox},
35\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
36
37\latexignore{\rtfignore{\wxheading{Members}}}
38
39\membersection{wxChoice::wxChoice}\label{wxchoiceconstr}
40
41\func{}{wxChoice}{\void}
42
43Default constructor.
44
45\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
46\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
47\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
48\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
49
50Constructor, creating and showing a choice.
51
52\wxheading{Parameters}
53
54\docparam{parent}{Parent window. Must not be NULL.}
55
56\docparam{id}{Window identifier. A value of -1 indicates a default value.}
57
58\docparam{pos}{Window position.}
59
60\docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized
61appropriately.}
62
63\docparam{n}{Number of strings with which to initialise the choice control.}
64
65\docparam{choices}{An array of strings with which to initialise the choice control.}
66
67\docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.}
68
69\docparam{validator}{Window validator.}
70
71\docparam{name}{Window name.}
72
73\wxheading{See also}
74
75\helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator}
76
77\pythonnote{The wxChoice constructor in wxPython reduces the \tt{n}
78and \tt{choices} arguments are to a single argument, which is
79a list of strings.}
80
81\membersection{wxChoice::\destruct{wxChoice}}
82
83\func{}{\destruct{wxChoice}}{\void}
84
85Destructor, destroying the choice item.
86
87\membersection{wxChoice::Append}\label{wxchoiceappend}
88
89\func{void}{Append}{\param{const wxString\& }{ item}}
90
91Adds the item to the end of the choice control.
92
93\wxheading{Parameters}
94
95\docparam{item}{String to add.}
96
97\membersection{wxChoice::Clear}\label{wxchoiceclear}
98
99\func{void}{Clear}{\void}
100
101Clears the strings from the choice item.
102
103\membersection{wxChoice::Create}\label{wxchoicecreate}
104
105\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
106\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
107\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
108\param{long}{ style = 0}, \param{const wxString\& }{name = ``choice"}}
109
110Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoiceconstr}.
111
112\membersection{wxChoice::FindString}\label{wxchoicefindstring}
113
114\constfunc{int}{FindString}{\param{const wxString\& }{string}}
115
116Finds a choice matching the given string.
117
118\wxheading{Parameters}
119
120\docparam{string}{String to find.}
121
122\wxheading{Return value}
123
124Returns the position if found, or -1 if not found.
125
126\membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns}
127
128\constfunc{int}{GetColumns}{\void}
129
130Gets the number of columns in this choice item.
131
132\wxheading{Remarks}
133
134This is implemented for Motif only.
135
136\membersection{wxChoice::GetSelection}\label{wxchoicegetselection}
137
138\constfunc{int}{GetSelection}{\void}
139
140Gets the id (position) of the selected string, or -1 if there is no selection.
141
142\membersection{wxChoice::GetString}\label{wxchoicegetstring}
143
144\constfunc{wxString}{GetString}{\param{int}{ n}}
145
146Returns the string at the given position.
147
148\wxheading{Parameters}
149
150\docparam{n}{The zero-based position.}
151
152\wxheading{Return value}
153
154The string at the given position, or the empty string if {\it n} is invalid.
155
156\membersection{wxChoice::GetStringSelection}\label{wxchoicegetstringselection}
157
158\constfunc{wxString}{GetStringSelection}{\void}
159
160Gets the selected string, or the empty string if no string is selected.
161
162\membersection{wxChoice::Number}\label{wxchoicenumber}
163
164\constfunc{int}{Number}{\void}
165
166Returns the number of strings in the choice control.
167
168\membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns}
169
170\func{void}{SetColumns}{\param{int}{ n = 1}}
171
172Sets the number of columns in this choice item.
173
174\wxheading{Parameters}
175
176\docparam{n}{Number of columns.}
177
178\wxheading{Remarks}
179
180This is implemented for Motif only.
181
182\membersection{wxChoice::SetSelection}\label{wxchoicesetselection}
183
184\func{void}{SetSelection}{\param{int}{ n}}
185
186Sets the choice by passing the desired string position.
187
188\wxheading{Parameters}
189
190\docparam{n}{The string position to select, starting from zero.}
191
192\wxheading{See also}
193
194\helpref{wxChoice::SetStringSelection}{wxchoicesetstringselection}
195
196\membersection{wxChoice::SetStringSelection}\label{wxchoicesetstringselection}
197
198\func{void}{SetStringSelection}{\param{const wxString\& }{ string}}
199
200Sets the choice by passing the desired string.
201
202\wxheading{Parameters}
203
204\docparam{string}{The string to select.}
205
206\wxheading{See also}
207
208\helpref{wxChoice::SetSelection}{wxchoicesetselection}
209
210