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