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