]>
Commit | Line | Data |
---|---|---|
0dfff674 WS |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: comboctrl.tex | |
3 | %% Purpose: wxComboCtrl docs | |
4 | %% Author: Jaakko Salli | |
5 | %% Modified by: | |
6 | %% Created: | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) Jaakko Salli | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
12 | \section{\class{wxComboCtrl}}\label{wxcomboctrl} | |
13 | ||
14 | A combo control is a generic combobox that allows totally | |
15 | custom popup. In addition it has other customization features. | |
16 | For instance, position and size of the dropdown button | |
17 | can be changed. | |
18 | ||
19 | \wxheading{Setting Custom Popup for wxComboCtrl} | |
20 | ||
21 | wxComboCtrl needs to be told somehow which control to use | |
22 | and this is done by SetPopupControl(). However, we need | |
23 | something more than just a wxControl in this method as, | |
24 | for example, we need to call SetStringValue("initial text value") | |
25 | and wxControl doesn't have such method. So we also need a | |
26 | \helpref{wxComboPopup}{wxcombopopup} which is an interface which | |
27 | must be implemented by a control to be usable as a popup. | |
28 | ||
29 | We couldn't derive wxComboPopup from wxControl as this would make it | |
30 | impossible to have a class deriving from a wxWidgets control and from | |
31 | it, so instead it is just a mix-in. | |
32 | ||
33 | Here's a minimal sample of \helpref{wxListView}{wxlistview} popup: | |
34 | ||
35 | \begin{verbatim} | |
36 | ||
37 | #include <wx/combo.h> | |
38 | #include <wx/listctrl.h> | |
39 | ||
40 | class wxListViewComboPopup : public wxListView, | |
41 | public wxComboPopup | |
42 | { | |
43 | public: | |
44 | ||
45 | // Initialize member variables | |
46 | virtual void Init() | |
47 | { | |
48 | m_value = -1; | |
49 | } | |
50 | ||
51 | // Create popup control | |
52 | virtual bool Create(wxWindow* parent) | |
53 | { | |
54 | return wxListView::Create(parent,1,wxPoint(0,0),wxDefaultSize); | |
55 | } | |
56 | ||
57 | // Return pointer to the created control | |
58 | virtual wxWindow *GetControl() { return this; } | |
59 | ||
60 | // Translate string into a list selection | |
61 | virtual void SetStringValue(const wxString& s) | |
62 | { | |
63 | int n = wxListView::FindItem(-1,s); | |
64 | if ( n >= 0 && n < wxListView::GetItemCount() ) | |
65 | wxListView::Select(n); | |
66 | } | |
67 | ||
68 | // Get list selection as a string | |
69 | virtual wxString GetStringValue() const | |
70 | { | |
71 | if ( m_value >= 0 ) | |
72 | return wxListView::GetItemText(m_value); | |
73 | return wxEmptyString; | |
74 | } | |
75 | ||
76 | // Do mouse hot-tracking (which is typical in list popups) | |
77 | void OnMouseMove(wxMouseEvent& event) | |
78 | { | |
79 | // TODO: Move selection to cursor | |
80 | } | |
81 | ||
82 | // On mouse left up, set the value and close the popup | |
83 | void OnMouseClick(wxMouseEvent& WXUNUSED(event)) | |
84 | { | |
85 | m_value = wxListView::GetFirstSelected(); | |
86 | ||
87 | // TODO: Send event as well | |
88 | ||
89 | Dismiss(); | |
90 | } | |
91 | ||
92 | protected: | |
93 | ||
94 | int m_value; // current item index | |
95 | ||
96 | private: | |
97 | DECLARE_EVENT_TABLE() | |
98 | }; | |
99 | ||
100 | BEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView) | |
101 | EVT_MOTION(wxListViewComboPopup::OnMouseMove) | |
102 | EVT_LEFT_UP(wxListViewComboPopup::OnMouseClick) | |
103 | END_EVENT_TABLE() | |
104 | ||
105 | \end{verbatim} | |
106 | ||
107 | Here's how you would create and populate it in a dialog constructor: | |
108 | ||
109 | \begin{verbatim} | |
110 | ||
111 | wxComboCtrl* comboCtrl = new wxComboCtrl(this,wxID_ANY,wxEmptyString); | |
112 | ||
113 | wxListViewComboPopup* popupCtrl = new wxListViewComboPopup(); | |
114 | ||
115 | comboCtrl->SetPopupControl(popupCtrl); | |
116 | ||
117 | // Populate using wxListView methods | |
118 | popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("First Item")); | |
119 | popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("Second Item")); | |
120 | popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("Third Item")); | |
121 | ||
122 | \end{verbatim} | |
123 | ||
124 | \wxheading{Derived from} | |
125 | ||
126 | \helpref{wxControl}{wxcontrol}\\ | |
127 | \helpref{wxWindow}{wxwindow}\\ | |
128 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
129 | \helpref{wxObject}{wxobject} | |
130 | ||
131 | \wxheading{Include files} | |
132 | ||
133 | <combo.h> | |
134 | ||
135 | \wxheading{Window styles} | |
136 | ||
137 | \begin{twocollist}\itemsep=0pt | |
138 | \twocolitem{\windowstyle{wxCB\_READONLY}}{Text will not be editable.} | |
139 | \twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries in the list alphabetically.} | |
591087ed | 140 | \twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate |
0dfff674 WS |
141 | the event wxEVT\_COMMAND\_TEXT\_ENTER (otherwise pressing Enter key |
142 | is either processed internally by the control or used for navigation between | |
143 | dialog controls). Windows only.} | |
144 | \twocolitem{\windowstyle{wxCC\_SPECIAL\_DCLICK}}{Double-clicking triggers a call | |
145 | to popup's OnComboDoubleClick. Actual behaviour is defined by a derived | |
146 | class. For instance, wxOwnerDrawnComboBox will cycle an item. This style only | |
147 | applies if wxCB\_READONLY is used as well.} | |
0dfff674 WS |
148 | \twocolitem{\windowstyle{wxCC\_STD\_BUTTON}}{Drop button will behave |
149 | more like a standard push button.} | |
150 | \end{twocollist} | |
151 | ||
152 | See also \helpref{window styles overview}{windowstyles}. | |
153 | ||
154 | \wxheading{Event handling} | |
155 | ||
156 | \twocolwidtha{7cm} | |
157 | \begin{twocollist}\itemsep=0pt | |
158 | \twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event, | |
159 | when the text changes.} | |
160 | \twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_ENTER event, | |
161 | when <RETURN> is pressed in the combo control.} | |
162 | \end{twocollist} | |
163 | ||
164 | \wxheading{See also} | |
165 | ||
166 | \helpref{wxComboBox}{wxcombobox}, \helpref{wxChoice}{wxchoice}, | |
167 | \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}, | |
168 | \rtfsp\helpref{wxComboPopup}{wxcombopopup}, \helpref{wxCommandEvent}{wxcommandevent} | |
169 | ||
170 | \latexignore{\rtfignore{\wxheading{Members}}} | |
171 | ||
172 | ||
173 | \membersection{wxComboCtrl::wxComboCtrl}\label{wxcomboctrlctor} | |
174 | ||
175 | \func{}{wxComboCtrl}{\void} | |
176 | ||
177 | Default constructor. | |
178 | ||
179 | \func{}{wxComboCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp | |
180 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp | |
181 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboCtrl"}} | |
182 | ||
183 | Constructor, creating and showing a combo control. | |
184 | ||
185 | \wxheading{Parameters} | |
186 | ||
187 | \docparam{parent}{Parent window. Must not be NULL.} | |
188 | ||
189 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
190 | ||
191 | \docparam{value}{Initial selection string. An empty string indicates no selection.} | |
192 | ||
193 | \docparam{pos}{Window position.} | |
194 | ||
195 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized | |
196 | appropriately.} | |
197 | ||
198 | \docparam{style}{Window style. See \helpref{wxComboCtrl}{wxcomboctrl}.} | |
199 | ||
200 | \docparam{validator}{Window validator.} | |
201 | ||
202 | \docparam{name}{Window name.} | |
203 | ||
204 | \wxheading{See also} | |
205 | ||
206 | \helpref{wxComboCtrl::Create}{wxcomboctrlcreate}, \helpref{wxValidator}{wxvalidator} | |
207 | ||
208 | ||
209 | \membersection{wxComboCtrl::\destruct{wxComboCtrl}}\label{wxcomboctrldtor} | |
210 | ||
211 | \func{}{\destruct{wxComboCtrl}}{\void} | |
212 | ||
213 | Destructor, destroying the combo control. | |
214 | ||
215 | ||
974a12f8 RR |
216 | \membersection{wxComboCtrl::AnimateShow}\label{wxcomboctrlanimateshow} |
217 | ||
218 | \func{virtual bool}{AnimateShow}{\param{const wxRect\& }{rect}, \param{int }{flags}} | |
219 | ||
220 | This member function is not normally called in application code. | |
221 | Instead, it can be implemented in a derived class to create a | |
222 | custom popup animation. | |
223 | ||
224 | \wxheading{Parameters} | |
225 | ||
226 | Same as in \helpref{DoShowPopup}{wxcomboctrldoshowpopup}. | |
227 | ||
228 | \wxheading{Return value} | |
229 | ||
230 | \true if animation finishes before the function returns. | |
231 | \false otherwise. In the latter case you need to manually call DoShowPopup | |
232 | after the animation ends. | |
233 | ||
234 | ||
0dfff674 WS |
235 | \membersection{wxComboCtrl::Create}\label{wxcomboctrlcreate} |
236 | ||
237 | \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp | |
238 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp | |
239 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboCtrl"}} | |
240 | ||
241 | Creates the combo control for two-step construction. Derived classes | |
242 | should call or replace this function. See \helpref{wxComboCtrl::wxComboCtrl}{wxcomboctrlctor}\rtfsp | |
243 | for further details. | |
244 | ||
245 | ||
246 | \membersection{wxComboCtrl::Copy}\label{wxcomboctrlcopy} | |
247 | ||
248 | \func{void}{Copy}{\void} | |
249 | ||
250 | Copies the selected text to the clipboard. | |
251 | ||
252 | ||
253 | \membersection{wxComboCtrl::Cut}\label{wxcomboctrlcut} | |
254 | ||
255 | \func{void}{Cut}{\void} | |
256 | ||
257 | Copies the selected text to the clipboard and removes the selection. | |
258 | ||
259 | ||
df348ff8 RR |
260 | \membersection{wxComboCtrl::DoSetPopupControl}\label{wxcomboctrldosetpopupcontrol} |
261 | ||
262 | \func{void}{DoSetPopupControl}{\param{wxComboPopup* }{popup}} | |
263 | ||
264 | This member function is not normally called in application code. | |
265 | Instead, it can be implemented in a derived class to return | |
266 | default wxComboPopup, incase {\tt popup} is NULL. | |
267 | ||
268 | \textbf{Note:} If you have implemented OnButtonClick to do | |
269 | something else than show the popup, then DoSetPopupControl | |
270 | must always return NULL. | |
271 | ||
272 | ||
974a12f8 RR |
273 | \membersection{wxComboCtrl::DoShowPopup}\label{wxcomboctrldoshowpopup} |
274 | ||
275 | \func{virtual void}{DoShowPopup}{\param{const wxRect\& }{rect}, \param{int }{flags}} | |
276 | ||
277 | This member function is not normally called in application code. | |
278 | Instead, it must be called in a derived class to make sure popup | |
279 | is properly shown after a popup animation has finished (but only | |
280 | if \helpref{AnimateShow}{wxcomboctrlanimateshow} did not finish | |
281 | the animation within it's function scope). | |
282 | ||
283 | \wxheading{Parameters} | |
284 | ||
285 | \docparam{rect}{Position to show the popup window at, in screen coordinates.} | |
286 | ||
287 | \docparam{flags}{Combination of any of the following:} | |
288 | \twocolwidtha{8cm}% | |
289 | \begin{twocollist}\itemsep=0pt | |
290 | \twocolitem{{\tt wxComboCtrl::ShowAbove}}{Popup is shown above the control instead | |
291 | of below.} | |
292 | \twocolitem{{\tt wxComboCtrl::CanDeferShow}}{Showing the popup can be deferred | |
293 | to happen sometime after \helpref{ShowPopup}{wxcomboctrlshowpopup} has finished. | |
294 | In this case, \helpref{AnimateShow}{wxcomboctrlanimateshow} must return \false.} | |
295 | \end{twocollist} | |
296 | ||
297 | ||
0dfff674 WS |
298 | \membersection{wxComboCtrl::GetBitmapDisabled}\label{wxcomboctrlgetbitmapdisabled} |
299 | ||
300 | \constfunc{const wxBitmap\&}{GetBitmapDisabled}{\void} | |
301 | ||
302 | Returns disabled button bitmap that has been set with | |
303 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
304 | ||
305 | \wxheading{Return value} | |
306 | ||
307 | A reference to the disabled state bitmap. | |
308 | ||
309 | ||
310 | \membersection{wxComboCtrl::GetBitmapHover}\label{wxcomboctrlgetbitmaphover} | |
311 | ||
312 | \constfunc{const wxBitmap\&}{GetBitmapHover}{\void} | |
313 | ||
314 | Returns button mouse hover bitmap that has been set with | |
315 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
316 | ||
317 | \wxheading{Return value} | |
318 | ||
319 | A reference to the mouse hover state bitmap. | |
320 | ||
321 | ||
322 | \membersection{wxComboCtrl::GetBitmapNormal}\label{wxcomboctrlgetbitmapnormal} | |
323 | ||
324 | \constfunc{const wxBitmap\&}{GetBitmapNormal}{\void} | |
325 | ||
326 | Returns default button bitmap that has been set with | |
327 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
328 | ||
329 | \wxheading{Return value} | |
330 | ||
331 | A reference to the normal state bitmap. | |
332 | ||
333 | ||
334 | \membersection{wxComboCtrl::GetBitmapPressed}\label{wxcomboctrlgetbitmappressed} | |
335 | ||
336 | \constfunc{const wxBitmap\&}{GetBitmapPressed}{\void} | |
337 | ||
338 | Returns depressed button bitmap that has been set with | |
339 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
340 | ||
341 | \wxheading{Return value} | |
342 | ||
343 | A reference to the depressed state bitmap. | |
344 | ||
345 | ||
7dc234d6 WS |
346 | \membersection{wxComboCtrl::GetButtonSize}\label{wxcomboctrlgetbuttonsize} |
347 | ||
348 | \func{wxSize}{GetButtonSize}{\void} | |
349 | ||
350 | Returns current size of the dropdown button. | |
351 | ||
352 | ||
0dfff674 WS |
353 | \membersection{wxComboCtrl::GetCustomPaintWidth}\label{wxcomboctrlgetcustompaintwidth} |
354 | ||
355 | \constfunc{int}{GetCustomPaintWidth}{\void} | |
356 | ||
357 | Returns custom painted area in control. | |
358 | ||
359 | \wxheading{See also} | |
360 | ||
361 | \helpref{wxComboCtrl::SetCustomPaintWidth}{wxcomboctrlsetcustompaintwidth}. | |
362 | ||
363 | ||
364 | \membersection{wxComboCtrl::GetFeatures}\label{wxcomboctrlgetfeatures} | |
365 | ||
366 | \func{static int}{GetFeatures}{\void} | |
367 | ||
368 | Returns features supported by wxComboCtrl. If needed feature is missing, | |
369 | you need to instead use wxGenericComboCtrl, which however may lack | |
370 | native look and feel (but otherwise sports identical API). | |
371 | ||
372 | \wxheading{Return value} | |
373 | ||
374 | Value returned is a combination of following flags: | |
375 | ||
376 | \twocolwidtha{8cm}% | |
377 | \begin{twocollist}\itemsep=0pt | |
378 | \twocolitem{{\tt wxComboCtrlFeatures::MovableButton}}{Button can | |
379 | be on either side of the control.} | |
380 | \twocolitem{{\tt wxComboCtrlFeatures::BitmapButton}}{Button may | |
381 | be replaced with bitmap.} | |
382 | \twocolitem{{\tt wxComboCtrlFeatures::ButtonSpacing}}{Button can | |
383 | have spacing.} | |
384 | \twocolitem{{\tt wxComboCtrlFeatures::TextIndent}}{SetTextIndent | |
385 | works.} | |
386 | \twocolitem{{\tt wxComboCtrlFeatures::PaintControl}}{Combo control | |
387 | itself can be custom painted.} | |
388 | \twocolitem{{\tt wxComboCtrlFeatures::PaintWritable}}{A variable- | |
389 | width area in front of writable combo control's textctrl can | |
390 | be custom painted.} | |
391 | \twocolitem{{\tt wxComboCtrlFeatures::Borderless}}{wxNO\_BORDER | |
392 | window style works.} | |
393 | \twocolitem{{\tt wxComboCtrlFeatures::All}}{All of the | |
394 | above.} | |
395 | \end{twocollist} | |
396 | ||
397 | ||
398 | \membersection{wxComboCtrl::GetInsertionPoint}\label{wxcomboctrlgetinsertionpoint} | |
399 | ||
400 | \constfunc{long}{GetInsertionPoint}{\void} | |
401 | ||
402 | Returns the insertion point for the combo control's text field. | |
403 | ||
404 | \textbf{Note:} Under wxMSW, this function always returns $0$ if the combo control | |
405 | doesn't have the focus. | |
406 | ||
407 | ||
974a12f8 RR |
408 | \membersection{wxComboCtrl::IsPopupWindowState}\label{wxcomboctrlispopupwindowstate} |
409 | ||
410 | \constfunc{bool}{IsPopupWindowState}{\param{int }{state}} | |
411 | ||
412 | Returns \true if the popup window is in the given state. | |
413 | Possible values are: | |
414 | \twocolwidtha{8cm}% | |
415 | \begin{twocollist}\itemsep=0pt | |
416 | \twocolitem{{\tt wxComboCtrl::Hidden}}{Popup window is hidden.} | |
417 | \twocolitem{{\tt wxComboCtrl::Animating}}{Popup window is being shown, but the | |
418 | popup animation has not yet finished.} | |
419 | \twocolitem{{\tt wxComboCtrl::Visible}}{Popup window is fully visible.} | |
420 | \end{twocollist} | |
421 | ||
422 | ||
423 | ||
0dfff674 WS |
424 | \membersection{wxComboCtrl::GetLastPosition}\label{wxcomboctrlgetlastposition} |
425 | ||
426 | \constfunc{long}{GetLastPosition}{\void} | |
427 | ||
428 | Returns the last position in the combo control text field. | |
429 | ||
430 | ||
431 | \membersection{wxComboCtrl::GetPopupControl}\label{wxcomboctrlgetpopupcontrol} | |
432 | ||
433 | \func{wxComboPopup*}{GetPopupControl}{\void} | |
434 | ||
435 | Returns current popup interface that has been set with SetPopupControl. | |
436 | ||
437 | ||
438 | \membersection{wxComboCtrl::GetPopupWindow}\label{wxcomboctrlgetpopupwindow} | |
439 | ||
440 | \constfunc{wxWindow*}{GetPopupWindow}{\void} | |
441 | ||
442 | Returns popup window containing the popup control. | |
443 | ||
444 | ||
445 | \membersection{wxComboCtrl::GetTextCtrl}\label{wxcomboctrlgettextctrl} | |
446 | ||
447 | \constfunc{wxTextCtrl*}{GetTextCtrl}{\void} | |
448 | ||
449 | Get the text control which is part of the combo control. | |
450 | ||
451 | ||
452 | \membersection{wxComboCtrl::GetTextIndent}\label{wxcomboctrlgettextindent} | |
453 | ||
454 | \constfunc{wxCoord}{GetTextIndent}{\void} | |
455 | ||
456 | Returns actual indentation in pixels. | |
457 | ||
458 | ||
df348ff8 RR |
459 | \membersection{wxComboCtrl::GetTextRect}\label{wxcomboctrlgettextrect} |
460 | ||
461 | \constfunc{const wxRect\&}{GetTextRect}{\void} | |
462 | ||
463 | Returns area covered by the text field (includes everything except | |
464 | borders and the dropdown button). | |
465 | ||
466 | ||
0dfff674 WS |
467 | \membersection{wxComboCtrl::GetValue}\label{wxcomboctrlgetvalue} |
468 | ||
469 | \constfunc{wxString}{GetValue}{\void} | |
470 | ||
471 | Returns text representation of the current value. For writable | |
472 | combo control it always returns the value in the text field. | |
473 | ||
474 | ||
475 | \membersection{wxComboCtrl::HidePopup}\label{wxcomboctrlhidepopup} | |
476 | ||
477 | \func{void}{HidePopup}{\void} | |
478 | ||
479 | Dismisses the popup window. | |
480 | ||
481 | ||
482 | \membersection{wxComboCtrl::IsPopupShown}\label{wxcomboctrlispopupshown} | |
483 | ||
484 | \constfunc{bool}{IsPopupShown}{\void} | |
485 | ||
486 | Returns \true if the popup is currently shown | |
487 | ||
488 | ||
489 | \membersection{wxComboCtrl::OnButtonClick}\label{wxcomboctrlonbuttonclick} | |
490 | ||
491 | \func{void}{OnButtonClick}{\void} | |
492 | ||
493 | Implement in a derived class to define what happens on | |
494 | dropdown button click. | |
495 | ||
496 | Default action is to show the popup. | |
497 | ||
df348ff8 RR |
498 | \textbf{Note:} If you implement this to do something else than |
499 | show the popup, you must then also implement | |
500 | \helpref{DoSetPopupControl}{wxcomboctrldosetpopupcontrol} to always | |
501 | return NULL. | |
502 | ||
0dfff674 WS |
503 | |
504 | \membersection{wxComboCtrl::Paste}\label{wxcomboctrlpaste} | |
505 | ||
506 | \func{void}{Paste}{\void} | |
507 | ||
508 | Pastes text from the clipboard to the text field. | |
509 | ||
510 | ||
511 | \membersection{wxComboCtrl::Remove}\label{wxcomboctrlremove} | |
512 | ||
513 | \func{void}{Remove}{\param{long }{from}, \param{long }{to}} | |
514 | ||
515 | Removes the text between the two positions in the combo control text field. | |
516 | ||
517 | \wxheading{Parameters} | |
518 | ||
519 | \docparam{from}{The first position.} | |
520 | ||
521 | \docparam{to}{The last position.} | |
522 | ||
523 | ||
524 | \membersection{wxComboCtrl::Replace}\label{wxcomboctrlreplace} | |
525 | ||
526 | \func{void}{Replace}{\param{long }{from}, \param{long }{to}, \param{const wxString\& }{value}} | |
527 | ||
528 | Replaces the text between two positions with the given text, in the combo control text field. | |
529 | ||
530 | \wxheading{Parameters} | |
531 | ||
532 | \docparam{from}{The first position.} | |
533 | ||
534 | \docparam{to}{The second position.} | |
535 | ||
536 | \docparam{text}{The text to insert.} | |
537 | ||
538 | ||
539 | \membersection{wxComboCtrl::SetButtonBitmaps}\label{wxcomboctrlsetbuttonbitmaps} | |
540 | ||
541 | \func{void}{SetButtonBitmaps}{\param{const wxBitmap\& }{bmpNormal}, \param{bool }{pushButtonBg = false}, \param{const wxBitmap\& }{bmpPressed = wxNullBitmap}, \param{const wxBitmap\& }{bmpHover = wxNullBitmap}, \param{const wxBitmap\& }{bmpDisabled = wxNullBitmap}} | |
542 | ||
543 | Sets custom dropdown button graphics. | |
544 | ||
545 | \wxheading{Parameters} | |
546 | ||
547 | \docparam{bmpNormal}{Default button image.} | |
548 | \docparam{pushButtonBg}{If \true, blank push button background is painted | |
549 | below the image.} | |
550 | \docparam{bmpPressed}{Depressed button image.} | |
551 | \docparam{bmpHover}{Button image when mouse hovers above it. This | |
552 | should be ignored on platforms and themes that do not generally draw | |
553 | different kind of button on mouse hover.} | |
554 | \docparam{bmpDisabled}{Disabled button image.} | |
555 | ||
556 | ||
557 | \membersection{wxComboCtrl::SetButtonPosition}\label{wxcomboctrlsetbuttonposition} | |
558 | ||
7dc234d6 | 559 | \func{void}{SetButtonPosition}{\param{int }{width = -1}, \param{int }{height = -1}, \param{int }{side = wxRIGHT}, \param{int }{spacingX = 0}} |
0dfff674 WS |
560 | |
561 | Sets size and position of dropdown button. | |
562 | ||
563 | \wxheading{Parameters} | |
564 | ||
7dc234d6 WS |
565 | \docparam{width}{Button width. Value <= $0$ specifies default.} |
566 | \docparam{height}{Button height. Value <= $0$ specifies default.} | |
0dfff674 WS |
567 | \docparam{side}{Indicates which side the button will be placed. |
568 | Value can be {\tt wxLEFT} or {\tt wxRIGHT}.} | |
569 | \docparam{spacingX}{Horizontal spacing around the button. Default is $0$.} | |
570 | ||
571 | ||
572 | \membersection{wxComboCtrl::SetCustomPaintWidth}\label{wxcomboctrlsetcustompaintwidth} | |
573 | ||
574 | \func{void}{SetCustomPaintWidth}{\param{int }{width}} | |
575 | ||
576 | Set width, in pixels, of custom painted area in control without {\tt wxCB\_READONLY} | |
577 | style. In read-only \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}, this is used | |
578 | to indicate area that is not covered by the focus rectangle. | |
579 | ||
580 | ||
581 | \membersection{wxComboCtrl::SetInsertionPoint}\label{wxcomboctrlsetinsertionpoint} | |
582 | ||
583 | \func{void}{SetInsertionPoint}{\param{long }{pos}} | |
584 | ||
585 | Sets the insertion point in the text field. | |
586 | ||
587 | \wxheading{Parameters} | |
588 | ||
589 | \docparam{pos}{The new insertion point.} | |
590 | ||
591 | ||
592 | \membersection{wxComboCtrl::SetInsertionPointEnd}\label{wxcomboctrlsetinsertionpointend} | |
593 | ||
594 | \func{void}{SetInsertionPointEnd}{\void} | |
595 | ||
596 | Sets the insertion point at the end of the combo control text field. | |
597 | ||
598 | ||
599 | \membersection{wxComboCtrl::SetPopupAnchor}\label{wxcomboctrlsetpopupanchor} | |
600 | ||
601 | \func{void}{SetPopupAnchor}{\param{int }{anchorSide}} | |
602 | ||
603 | Set side of the control to which the popup will align itself. Valid values are | |
604 | {\tt wxLEFT}, {\tt wxRIGHT} and $0$. The default value $0$ means that the most appropriate | |
605 | side is used (which, currently, is always {\tt wxLEFT}). | |
606 | ||
607 | ||
608 | \membersection{wxComboCtrl::SetPopupControl}\label{wxcomboctrlsetpopupcontrol} | |
609 | ||
610 | \func{void}{SetPopupControl}{\param{wxComboPopup* }{popup}} | |
611 | ||
612 | Set popup interface class derived from wxComboPopup. | |
613 | This method should be called as soon as possible after the control | |
614 | has been created, unless \helpref{OnButtonClick}{wxcomboctrlonbuttonclick} | |
615 | has been overridden. | |
616 | ||
617 | ||
618 | \membersection{wxComboCtrl::SetPopupExtents}\label{wxcomboctrlsetpopupextents} | |
619 | ||
620 | \func{void}{SetPopupExtents}{\param{int }{extLeft}, \param{int }{extRight}} | |
621 | ||
622 | Extends popup size horizontally, relative to the edges of the combo control. | |
623 | ||
624 | \wxheading{Parameters} | |
625 | ||
626 | \docparam{extLeft}{How many pixel to extend beyond the left edge of the | |
627 | control. Default is $0$.} | |
628 | \docparam{extRight}{How many pixel to extend beyond the right edge of the | |
629 | control. Default is $0$.} | |
630 | ||
631 | \wxheading{Remarks} | |
632 | ||
633 | Popup minimum width may override arguments. | |
634 | ||
635 | It is up to the popup to fully take this into account. | |
636 | ||
637 | ||
638 | \membersection{wxComboCtrl::SetPopupMaxHeight}\label{wxcomboctrlsetpopupmaxheight} | |
639 | ||
640 | \func{void}{SetPopupMaxHeight}{\param{int }{height}} | |
641 | ||
642 | Sets preferred maximum height of the popup. | |
643 | ||
644 | \wxheading{Remarks} | |
645 | ||
646 | Value -1 indicates the default. | |
647 | ||
648 | Also, popup implementation may choose to ignore this. | |
649 | ||
650 | ||
651 | \membersection{wxComboCtrl::SetPopupMinWidth}\label{wxcomboctrlsetpopupminwidth} | |
652 | ||
653 | \func{void}{SetPopupMinWidth}{\param{int }{width}} | |
654 | ||
655 | Sets minimum width of the popup. If wider than combo control, it will extend to the left. | |
656 | ||
657 | \wxheading{Remarks} | |
658 | ||
659 | Value -1 indicates the default. | |
660 | ||
661 | Also, popup implementation may choose to ignore this. | |
662 | ||
663 | ||
664 | \membersection{wxComboCtrl::SetSelection}\label{wxcomboctrlsetselection} | |
665 | ||
666 | \func{void}{SetSelection}{\param{long }{from}, \param{long }{to}} | |
667 | ||
668 | Selects the text between the two positions, in the combo control text field. | |
669 | ||
670 | \wxheading{Parameters} | |
671 | ||
672 | \docparam{from}{The first position.} | |
673 | ||
674 | \docparam{to}{The second position.} | |
675 | ||
676 | ||
677 | \membersection{wxComboCtrl::SetText}\label{wxcomboctrlsettext} | |
678 | ||
679 | \func{void}{SetText}{\param{const wxString\& }{value}} | |
680 | ||
681 | Sets the text for the text field without affecting the | |
682 | popup. Thus, unlike \helpref{SetValue}{wxcomboctrlsetvalue}, it works | |
683 | equally well with combo control using {\tt wxCB\_READONLY} style. | |
684 | ||
685 | ||
686 | \membersection{wxComboCtrl::SetTextIndent}\label{wxcomboctrlsettextindent} | |
687 | ||
688 | \func{void}{SetTextIndent}{\param{int }{indent}} | |
689 | ||
690 | This will set the space in pixels between left edge of the control and the | |
691 | text, regardless whether control is read-only or not. Value -1 can be | |
692 | given to indicate platform default. | |
693 | ||
694 | ||
695 | \membersection{wxComboCtrl::SetValue}\label{wxcomboctrlsetvalue} | |
696 | ||
697 | \func{void}{SetValue}{\param{const wxString\& }{value}} | |
698 | ||
699 | Sets the text for the combo control text field. | |
700 | ||
701 | {\bf NB:} For a combo control with {\tt wxCB\_READONLY} style the | |
702 | string must be accepted by the popup (for instance, exist in the dropdown | |
703 | list), otherwise the call to SetValue() is ignored | |
704 | ||
705 | ||
df348ff8 RR |
706 | \membersection{wxComboCtrl::SetValueWithEvent}\label{wxcomboctrlsetvaluewithevent} |
707 | ||
708 | \func{void}{SetValueWithEvent}{\param{const wxString\& }{value}, \param{bool }{withEvent = true}} | |
709 | ||
710 | Same as SetValue, but also sends wxCommandEvent of type wxEVT\_COMMAND\_TEXT\_UPDATED | |
711 | if {\tt withEvent} is \true. | |
712 | ||
713 | ||
0dfff674 WS |
714 | \membersection{wxComboCtrl::ShowPopup}\label{wxcomboctrlshowpopup} |
715 | ||
716 | \func{void}{ShowPopup}{\void} | |
717 | ||
718 | Show the popup. | |
719 | ||
720 | ||
721 | \membersection{wxComboCtrl::Undo}\label{wxcomboctrlundo} | |
722 | ||
723 | \func{void}{Undo}{\void} | |
724 | ||
725 | Undoes the last edit in the text field. Windows only. | |
b67a86d5 | 726 | |
06077aaf VZ |
727 | |
728 | \membersection{wxComboCtrl::UseAltPopupWindow}\label{wxcomboctrlusealtpopupwindow} | |
729 | ||
730 | \func{void}{UseAltPopupWindow}{\param{bool }{enable = true}} | |
731 | ||
732 | Enable or disable usage of an alternative popup window, which guarantees | |
733 | ability to focus the popup control, and allows common native controls to | |
734 | function normally. This alternative popup window is usually a wxDialog, | |
735 | and as such, when it is shown, its parent top-level window will appear | |
736 | as if the focus has been lost from it. | |
737 | ||
738 |