]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/choice.tex
Commited patch for wxSizer::Replace()
[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
a660d684
KB
30\wxheading{Window styles}
31
32There are no special styles for wxChoice.
33
34See also \helpref{window styles overview}{windowstyles}.
35
5de76427
JS
36\wxheading{Event handling}
37
38\twocolwidtha{7cm}
39\begin{twocollist}\itemsep=0pt
40\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event,
41when an item on the list is selected.}
42\end{twocollist}
43
a660d684
KB
44\wxheading{See also}
45
5de76427
JS
46\helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox},
47\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
a660d684
KB
48
49\latexignore{\rtfignore{\wxheading{Members}}}
50
6ba93d23 51
f510b7b2 52\membersection{wxChoice::wxChoice}\label{wxchoicector}
a660d684
KB
53
54\func{}{wxChoice}{\void}
55
56Default constructor.
57
eaaa6a06 58\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
a660d684 59\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
eaaa6a06
JS
60\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
61\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
a660d684 62
56b88f12
MB
63\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
64\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
65\param{const wxArrayString\& }{choices},\rtfsp
66\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
67
a660d684
KB
68Constructor, creating and showing a choice.
69
70\wxheading{Parameters}
71
72\docparam{parent}{Parent window. Must not be NULL.}
73
74\docparam{id}{Window identifier. A value of -1 indicates a default value.}
75
76\docparam{pos}{Window position.}
77
78\docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized
79appropriately.}
80
81\docparam{n}{Number of strings with which to initialise the choice control.}
82
83\docparam{choices}{An array of strings with which to initialise the choice control.}
84
85\docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.}
86
87\docparam{validator}{Window validator.}
88
89\docparam{name}{Window name.}
90
91\wxheading{See also}
92
93\helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator}
94
c9110876
VS
95\pythonnote{The wxChoice constructor in wxPython reduces the {\tt n}
96and {\tt choices} arguments are to a single argument, which is
06d20283
RD
97a list of strings.}
98
5873607e
VZ
99\perlnote{In wxPerl there is just an array reference in place of {\tt n}
100and {\tt choices}.}
101
6ba93d23 102
f510b7b2 103\membersection{wxChoice::\destruct{wxChoice}}\label{wxchoicedtor}
a660d684
KB
104
105\func{}{\destruct{wxChoice}}{\void}
106
107Destructor, destroying the choice item.
108
6ba93d23 109
a660d684
KB
110\membersection{wxChoice::Create}\label{wxchoicecreate}
111
eaaa6a06 112\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
a660d684 113\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
eaaa6a06 114\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
f6e9a818
RN
115\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
116\param{const wxString\& }{name = ``choice"}}
a660d684 117
56b88f12
MB
118\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
119\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
120\param{const wxArrayString\& }{choices},\rtfsp
f6e9a818
RN
121\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
122\param{const wxString\& }{name = ``choice"}}
56b88f12 123
f510b7b2 124Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoicector}.
a660d684 125
6ba93d23 126
a660d684
KB
127\membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns}
128
129\constfunc{int}{GetColumns}{\void}
130
131Gets the number of columns in this choice item.
132
133\wxheading{Remarks}
134
bed5584e
VZ
135This is implemented for Motif only and always returns $1$ for the other
136platforms.
9c884972 137
6ba93d23
VZ
138
139\membersection{wxChoice::GetCurrentSelection}\label{wxchoicegetcurrentselection}
140
141\constfunc{int}{GetCurrentSelection}{\void}
142
143Unlike \helpref{GetSelection}{wxcontrolwithitemsgetselection} which only
144returns the accepted selection value, i.e. the selection in the control once
145the user closes the dropdown list, this function returns the current selection.
146That is, while the dropdown list is shown, it returns the currently selected
147item in it. When it is not shown, its result is the same as for the other
148function.
149
aa61d352 150\newsince{2.6.2} (before this version
6ba93d23
VZ
151\helpref{GetSelection}{wxcontrolwithitemsgetselection} itself behaved like
152this).
153
154
a660d684
KB
155\membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns}
156
eaaa6a06 157\func{void}{SetColumns}{\param{int}{ n = 1}}
a660d684
KB
158
159Sets the number of columns in this choice item.
160
161\wxheading{Parameters}
162
163\docparam{n}{Number of columns.}
164
165\wxheading{Remarks}
166
bed5584e
VZ
167This is implemented for Motif only and doesn't do anything under other
168platforms.