]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/choice.tex
added wxRadioBox::IsItemEnabled/Shown() (for MSW only for now, other platforms to...
[wxWidgets.git] / docs / latex / wx / choice.tex
CommitLineData
a660d684
KB
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
bed5584e 9\helpref{wxControlWithItems}{wxcontrolwithitems}\\
a660d684
KB
10\helpref{wxControl}{wxcontrol}\\
11\helpref{wxWindow}{wxwindow}\\
12\helpref{wxEvtHandler}{wxevthandler}\\
13\helpref{wxObject}{wxobject}
14
954b8ae6
JS
15\wxheading{Include files}
16
17<wx/choice.h>
18
a660d684
KB
19\wxheading{Window styles}
20
21There are no special styles for wxChoice.
22
23See also \helpref{window styles overview}{windowstyles}.
24
5de76427
JS
25\wxheading{Event handling}
26
27\twocolwidtha{7cm}
28\begin{twocollist}\itemsep=0pt
29\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event,
30when an item on the list is selected.}
31\end{twocollist}
32
a660d684
KB
33\wxheading{See also}
34
5de76427
JS
35\helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox},
36\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
a660d684
KB
37
38\latexignore{\rtfignore{\wxheading{Members}}}
39
6ba93d23 40
f510b7b2 41\membersection{wxChoice::wxChoice}\label{wxchoicector}
a660d684
KB
42
43\func{}{wxChoice}{\void}
44
45Default constructor.
46
eaaa6a06 47\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
a660d684 48\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
eaaa6a06
JS
49\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
50\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
a660d684 51
56b88f12
MB
52\func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
53\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
54\param{const wxArrayString\& }{choices},\rtfsp
55\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
56
a660d684
KB
57Constructor, creating and showing a choice.
58
59\wxheading{Parameters}
60
61\docparam{parent}{Parent window. Must not be NULL.}
62
63\docparam{id}{Window identifier. A value of -1 indicates a default value.}
64
65\docparam{pos}{Window position.}
66
67\docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized
68appropriately.}
69
70\docparam{n}{Number of strings with which to initialise the choice control.}
71
72\docparam{choices}{An array of strings with which to initialise the choice control.}
73
74\docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.}
75
76\docparam{validator}{Window validator.}
77
78\docparam{name}{Window name.}
79
80\wxheading{See also}
81
82\helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator}
83
c9110876
VS
84\pythonnote{The wxChoice constructor in wxPython reduces the {\tt n}
85and {\tt choices} arguments are to a single argument, which is
06d20283
RD
86a list of strings.}
87
5873607e
VZ
88\perlnote{In wxPerl there is just an array reference in place of {\tt n}
89and {\tt choices}.}
90
6ba93d23 91
f510b7b2 92\membersection{wxChoice::\destruct{wxChoice}}\label{wxchoicedtor}
a660d684
KB
93
94\func{}{\destruct{wxChoice}}{\void}
95
96Destructor, destroying the choice item.
97
6ba93d23 98
a660d684
KB
99\membersection{wxChoice::Create}\label{wxchoicecreate}
100
eaaa6a06 101\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
a660d684 102\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
eaaa6a06 103\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
f6e9a818
RN
104\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
105\param{const wxString\& }{name = ``choice"}}
a660d684 106
56b88f12
MB
107\func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
108\param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
109\param{const wxArrayString\& }{choices},\rtfsp
f6e9a818
RN
110\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
111\param{const wxString\& }{name = ``choice"}}
56b88f12 112
f510b7b2 113Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoicector}.
a660d684 114
6ba93d23 115
645420d8
VZ
116\membersection{wxChoice::Delete}\label{wxchoicedelete}
117
118\func{void}{Delete}{\param{int }{n}}
119
120Deletes the item with the given index from the control.
121
122\wxheading{Parameters}
123
124\docparam{n}{The item to delete.}
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
150\newsince{2.6.2} (before this version
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.
a660d684 169