]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxComboBox}}\label{wxcombobox} |
2 | ||
3 | A combobox is like a combination of an edit control and a listbox. It can be | |
4 | displayed as static list with editable or read-only text field; or a drop-down list with | |
5 | text field; or a drop-down list without a text field. | |
6 | ||
7 | A combobox permits a single selection only. Combobox items are numbered from zero. | |
8 | ||
9 | \wxheading{Derived from} | |
10 | ||
11 | \helpref{wxChoice}{wxchoice}\\ | |
12 | \helpref{wxControl}{wxcontrol}\\ | |
13 | \helpref{wxWindow}{wxwindow}\\ | |
14 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
15 | \helpref{wxObject}{wxobject} | |
16 | ||
17 | \wxheading{Window styles} | |
18 | ||
19 | \begin{twocollist}\itemsep=0pt | |
20 | \twocolitem{\windowstyle{wxCB\_SIMPLE}}{Creates a combobox with a permanently displayed list.} | |
21 | \twocolitem{\windowstyle{wxCB\_DROPDOWN}}{Creates a combobox with a drop-down list.} | |
22 | \twocolitem{\windowstyle{wxCB\_READONLY}}{Creates a combo box consisting of a drop-down list and static text item | |
23 | displaying the current selection.} | |
24 | \twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries in the list alphabetically.} | |
25 | \end{twocollist} | |
26 | ||
27 | See also \helpref{window styles overview}{windowstyles}. | |
28 | ||
29 | \wxheading{See also} | |
30 | ||
31 | \helpref{wxListBox}{wxlistbox}, \helpref{wxTextCtrl}{wxtextctrl}, \helpref{wxChoice}{wxchoice} | |
32 | ||
33 | \latexignore{\rtfignore{\wxheading{Members}}} | |
34 | ||
35 | \membersection{wxComboBox::wxComboBox}\label{wxcomboboxconstr} | |
36 | ||
37 | \func{}{wxComboBox}{\void} | |
38 | ||
39 | Default constructor. | |
40 | ||
eaaa6a06 | 41 | \func{}{wxComboBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 42 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\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 = ``comboBox"}} | |
a660d684 KB |
45 | |
46 | Constructor, creating and showing a combobox. | |
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 window is sized | |
57 | appropriately.} | |
58 | ||
59 | \docparam{n}{Number of strings with which to initialise the control.} | |
60 | ||
61 | \docparam{choices}{An array of strings with which to initialise the control.} | |
62 | ||
63 | \docparam{style}{Window style. See \helpref{wxComboBox}{wxcombobox}.} | |
64 | ||
65 | \docparam{validator}{Window validator.} | |
66 | ||
67 | \docparam{name}{Window name.} | |
68 | ||
69 | \wxheading{See also} | |
70 | ||
71 | \helpref{wxComboBox::Create}{wxcomboboxcreate}, \helpref{wxValidator}{wxvalidator} | |
72 | ||
73 | \membersection{wxComboBox::\destruct{wxComboBox}} | |
74 | ||
75 | \func{}{\destruct{wxComboBox}}{\void} | |
76 | ||
77 | Destructor, destroying the combobox. | |
78 | ||
79 | \membersection{wxComboBox::Append}\label{wxcomboboxappend} | |
80 | ||
81 | \func{void}{Append}{\param{const wxString\& }{item}} | |
82 | ||
83 | Adds the item to the end of the combobox. | |
84 | ||
85 | \func{void}{Append}{\param{const wxString\& }{ item}, \param{char* }{clientData}} | |
86 | ||
87 | Adds the item to the end of the combobox, associating the given data | |
88 | with the item. | |
89 | ||
90 | \wxheading{Parameters} | |
91 | ||
92 | \docparam{item}{The string to add.} | |
93 | ||
94 | \docparam{clientData}{Client data to associate with the item.} | |
95 | ||
96 | \membersection{wxComboBox::Clear}\label{wxcomboboxclear} | |
97 | ||
98 | \func{void}{Clear}{\void} | |
99 | ||
100 | Clears all strings from the combobox. | |
101 | ||
102 | \membersection{wxComboBox::Create}\label{wxcomboboxcreate} | |
103 | ||
eaaa6a06 | 104 | \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 105 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 JS |
106 | \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp |
107 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}} | |
a660d684 KB |
108 | |
109 | Creates the combobox for two-step construction. Derived classes | |
110 | should call or replace this function. See \helpref{wxComboBox::wxComboBox}{wxcomboboxconstr}\rtfsp | |
111 | for further details. | |
112 | ||
113 | \membersection{wxComboBox::Copy}\label{wxcomboboxcopy} | |
114 | ||
115 | \func{void}{Copy}{\void} | |
116 | ||
117 | Copies the selected text to the clipboard. | |
118 | ||
119 | \membersection{wxComboBox::Cut}\label{wxcomboboxcut} | |
120 | ||
121 | \func{void}{Cut}{\void} | |
122 | ||
123 | Copies the selected text to the clipboard and removes the selection. | |
124 | ||
125 | \membersection{wxComboBox::Delete}\label{wxcomboboxdelete} | |
126 | ||
eaaa6a06 | 127 | \func{void}{Delete}{\param{int}{ n}} |
a660d684 KB |
128 | |
129 | Deletes an item from the combobox. | |
130 | ||
131 | \wxheading{Parameters} | |
132 | ||
133 | \docparam{n}{The item to delete, starting from zero.} | |
134 | ||
a660d684 KB |
135 | \membersection{wxComboBox::FindString}\label{wxcomboboxfindstring} |
136 | ||
137 | \func{int}{FindString}{\param{const wxString\& }{string}} | |
138 | ||
139 | Finds a choice matching the given string. | |
140 | ||
141 | \wxheading{Parameters} | |
142 | ||
143 | \docparam{string}{The item to find.} | |
144 | ||
145 | \wxheading{Return value} | |
146 | ||
147 | The position if found, or -1 if not found. | |
148 | ||
149 | \membersection{wxComboBox::GetClientData}\label{wxcomboboxgetclientdata} | |
150 | ||
eaaa6a06 | 151 | \constfunc{char*}{GetClientData}{\param{int}{ n}} |
a660d684 KB |
152 | |
153 | Returns a pointer to the client data associated with the given item (if any). | |
154 | ||
155 | \wxheading{Parameters} | |
156 | ||
157 | \docparam{n}{An item, starting from zero.} | |
158 | ||
159 | \wxheading{Return value} | |
160 | ||
161 | A pointer to the client data, or NULL if the item was not found. | |
162 | ||
163 | \membersection{wxComboBox::GetInsertionPoint}\label{wxcomboboxgetinsertionpoint} | |
164 | ||
165 | \constfunc{long}{GetInsertionPoint}{\void} | |
166 | ||
167 | Returns the insertion point for the combobox's text field. | |
168 | ||
169 | \membersection{wxComboBox::GetLastPosition}\label{wxcomboboxgetlastposition} | |
170 | ||
171 | \constfunc{long}{GetLastPosition}{\void} | |
172 | ||
173 | Returns the last position in the combobox text field. | |
174 | ||
175 | \membersection{wxComboBox::GetSelection}\label{wxcomboboxgetselection} | |
176 | ||
177 | \constfunc{int}{GetSelection}{\void} | |
178 | ||
179 | Gets the position of the selected string, or -1 if there is no selection. | |
180 | ||
181 | \membersection{wxComboBox::GetString}\label{wxcomboboxgetstring} | |
182 | ||
183 | \constfunc{wxString}{GetString}{\param{int}{ n}} | |
184 | ||
185 | Returns the string at position {\it n}. | |
186 | ||
187 | \wxheading{Parameters} | |
188 | ||
189 | \docparam{n}{The item position, starting from zero.} | |
190 | ||
191 | \wxheading{Return value} | |
192 | ||
193 | The string if the item is found, otherwise the empty string. | |
194 | ||
195 | \membersection{wxComboBox::GetStringSelection}\label{wxcomboboxgetstringselection} | |
196 | ||
197 | \constfunc{wxString}{GetStringSelection}{\void} | |
198 | ||
199 | Gets the selected string. | |
200 | ||
201 | \membersection{wxComboBox::GetValue}\label{wxcomboboxgetvalue} | |
202 | ||
203 | \constfunc{wxString}{GetValue}{\void} | |
204 | ||
205 | Returns the current value in the combobox text field. | |
206 | ||
207 | \membersection{wxComboBox::Number}\label{wxcomboboxnumber} | |
208 | ||
209 | \constfunc{int}{Number}{\void} | |
210 | ||
211 | Returns the number of items in the combobox list. | |
212 | ||
213 | TODO: make this GetNumber or GetCount? | |
214 | ||
215 | \membersection{wxComboBox::Paste}\label{wxcomboboxpaste} | |
216 | ||
217 | \func{void}{Paste}{\void} | |
218 | ||
219 | Pastes text from the clipboard to the text field. | |
220 | ||
221 | \membersection{wxComboBox::Replace}\label{wxcomboboxreplace} | |
222 | ||
eaaa6a06 | 223 | \func{void}{Replace}{\param{long}{ from}, \param{long}{ to}, \param{const wxString\& }{text}} |
a660d684 KB |
224 | |
225 | Replaces the text between two positions with the given text, in the combobox text field. | |
226 | ||
227 | \wxheading{Parameters} | |
228 | ||
229 | \docparam{from}{The first position.} | |
230 | ||
231 | \docparam{to}{The second position.} | |
232 | ||
233 | \docparam{text}{The text to insert.} | |
234 | ||
235 | \membersection{wxComboBox::Remove}\label{wxcomboboxremove} | |
236 | ||
eaaa6a06 | 237 | \func{void}{Remove}{\param{long}{ from}, \param{long}{ to}} |
a660d684 KB |
238 | |
239 | Removes the text between the two positions in the combobox text field. | |
240 | ||
241 | \wxheading{Parameters} | |
242 | ||
243 | \docparam{from}{The first position.} | |
244 | ||
245 | \docparam{to}{The last position.} | |
246 | ||
247 | \membersection{wxComboBox::SetClientData}\label{wxcomboboxsetclientdata} | |
248 | ||
eaaa6a06 | 249 | \func{void}{SetClientData}{\param{int}{ n}, \param{char* }{data}} |
a660d684 KB |
250 | |
251 | Associates the given client data pointer with the given item. | |
252 | ||
253 | \wxheading{Parameters} | |
254 | ||
255 | \docparam{n}{The zero-based item.} | |
256 | ||
257 | \docparam{data}{The client data.} | |
258 | ||
259 | \membersection{wxComboBox::SetInsertionPoint}\label{wxcomboboxsetinsertionpoint} | |
260 | ||
eaaa6a06 | 261 | \func{void}{SetInsertionPoint}{\param{long}{ pos}} |
a660d684 KB |
262 | |
263 | Sets the insertion point in the combobox text field. | |
264 | ||
265 | \wxheading{Parameters} | |
266 | ||
267 | \docparam{pos}{The new insertion point.} | |
268 | ||
269 | \membersection{wxComboBox::SetInsertionPointEnd}\label{wxcomboboxsetinsertionpointend} | |
270 | ||
271 | \func{void}{SetInsertionPointEnd}{\void} | |
272 | ||
273 | Sets the insertion point at the end of the combobox text field. | |
274 | ||
275 | \membersection{wxComboBox::SetSelection}\label{wxcomboboxsetselection} | |
276 | ||
eaaa6a06 | 277 | \func{void}{SetSelection}{\param{int}{ n}} |
a660d684 KB |
278 | |
279 | Selects the given item in the combobox list. | |
280 | ||
eaaa6a06 | 281 | \func{void}{SetSelection}{\param{long}{ from}, \param{long}{ to}} |
a660d684 KB |
282 | |
283 | Selects the text between the two positions, in the combobox text field. | |
284 | ||
285 | \wxheading{Parameters} | |
286 | ||
287 | \docparam{n}{The zero-based item to select.} | |
288 | ||
289 | \docparam{from}{The first position.} | |
290 | ||
291 | \docparam{to}{The second position.} | |
292 | ||
293 | \membersection{wxComboBox::SetValue}\label{wxcomboboxsetvalue} | |
294 | ||
295 | \func{void}{SetValue}{\param{const wxString\& }{text}} | |
296 | ||
297 | Sets the text for the combobox text field. | |
298 | ||
299 | \wxheading{Parameters} | |
300 | ||
301 | \docparam{text}{The text to set.} | |
302 | ||
303 |