]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/choice.tex
reorder the methods in alphabetical order (patch 1861348)
[wxWidgets.git] / docs / latex / wx / choice.tex
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
12 \section{\class{wxChoice}}\label{wxchoice}
13
14 A choice item is used to select one of a list of strings. Unlike a
15 listbox, only the selection is visible until the user pulls down the
16 menu of choices.
17
18 \wxheading{Derived from}
19
20 \helpref{wxControlWithItems}{wxcontrolwithitems}\\
21 \helpref{wxControl}{wxcontrol}\\
22 \helpref{wxWindow}{wxwindow}\\
23 \helpref{wxEvtHandler}{wxevthandler}\\
24 \helpref{wxObject}{wxobject}
25
26 \wxheading{Include files}
27
28 <wx/choice.h>
29
30 \wxheading{Library}
31
32 \helpref{wxCore}{librarieslist}
33
34 \wxheading{Window styles}
35
36 \begin{twocollist}\itemsep=0pt
37 \twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries alphabetically.}
38 \end{twocollist}
39
40 See also \helpref{window styles overview}{windowstyles}.
41
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,
47 when an item on the list is selected.}
48 \end{twocollist}
49
50 \wxheading{See also}
51
52 \helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox},
53 \rtfsp\helpref{wxCommandEvent}{wxcommandevent}
54
55 \latexignore{\rtfignore{\wxheading{Members}}}
56
57
58 \membersection{wxChoice::wxChoice}\label{wxchoicector}
59
60 \func{}{wxChoice}{\void}
61
62 Default constructor.
63
64 \func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
65 \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
66 \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
67 \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}}
68
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
74 Constructor, 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
85 appropriately.}
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
101 \pythonnote{The wxChoice constructor in wxPython reduces the {\tt n}
102 and {\tt choices} arguments are to a single argument, which is
103 a list of strings.}
104
105 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
106 and {\tt choices}.}
107
108
109 \membersection{wxChoice::\destruct{wxChoice}}\label{wxchoicedtor}
110
111 \func{}{\destruct{wxChoice}}{\void}
112
113 Destructor, destroying the choice item.
114
115
116 \membersection{wxChoice::Create}\label{wxchoicecreate}
117
118 \func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp
119 \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp
120 \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
121 \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
122 \param{const wxString\& }{name = ``choice"}}
123
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
127 \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
128 \param{const wxString\& }{name = ``choice"}}
129
130 Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoicector}.
131
132
133 \membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns}
134
135 \constfunc{int}{GetColumns}{\void}
136
137 Gets the number of columns in this choice item.
138
139 \wxheading{Remarks}
140
141 This is implemented for Motif only and always returns $1$ for the other
142 platforms.
143
144
145 \membersection{wxChoice::GetCurrentSelection}\label{wxchoicegetcurrentselection}
146
147 \constfunc{int}{GetCurrentSelection}{\void}
148
149 Unlike \helpref{GetSelection}{wxcontrolwithitemsgetselection} which only
150 returns the accepted selection value, i.e. the selection in the control once
151 the user closes the dropdown list, this function returns the current selection.
152 That is, while the dropdown list is shown, it returns the currently selected
153 item in it. When it is not shown, its result is the same as for the other
154 function.
155
156 \newsince{2.6.2} (before this version
157 \helpref{GetSelection}{wxcontrolwithitemsgetselection} itself behaved like
158 this).
159
160
161 \membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns}
162
163 \func{void}{SetColumns}{\param{int}{ n = 1}}
164
165 Sets the number of columns in this choice item.
166
167 \wxheading{Parameters}
168
169 \docparam{n}{Number of columns.}
170
171 \wxheading{Remarks}
172
173 This is implemented for Motif only and doesn't do anything under other
174 platforms.
175