]>
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 | ||
30be036c RR |
298 | \membersection{wxComboCtrl::EnablePopupAnimation}\label{wxcomboctrlenablepopupanimation} |
299 | ||
300 | \func{void}{EnablePopupAnimation}{\param{bool }{enable = true}} | |
301 | ||
302 | Enables or disables popup animation, if any, depending on the value of | |
303 | the argument. | |
304 | ||
305 | ||
0dfff674 WS |
306 | \membersection{wxComboCtrl::GetBitmapDisabled}\label{wxcomboctrlgetbitmapdisabled} |
307 | ||
308 | \constfunc{const wxBitmap\&}{GetBitmapDisabled}{\void} | |
309 | ||
310 | Returns disabled button bitmap that has been set with | |
311 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
312 | ||
313 | \wxheading{Return value} | |
314 | ||
315 | A reference to the disabled state bitmap. | |
316 | ||
317 | ||
318 | \membersection{wxComboCtrl::GetBitmapHover}\label{wxcomboctrlgetbitmaphover} | |
319 | ||
320 | \constfunc{const wxBitmap\&}{GetBitmapHover}{\void} | |
321 | ||
322 | Returns button mouse hover bitmap that has been set with | |
323 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
324 | ||
325 | \wxheading{Return value} | |
326 | ||
327 | A reference to the mouse hover state bitmap. | |
328 | ||
329 | ||
330 | \membersection{wxComboCtrl::GetBitmapNormal}\label{wxcomboctrlgetbitmapnormal} | |
331 | ||
332 | \constfunc{const wxBitmap\&}{GetBitmapNormal}{\void} | |
333 | ||
334 | Returns default button bitmap that has been set with | |
335 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
336 | ||
337 | \wxheading{Return value} | |
338 | ||
339 | A reference to the normal state bitmap. | |
340 | ||
341 | ||
342 | \membersection{wxComboCtrl::GetBitmapPressed}\label{wxcomboctrlgetbitmappressed} | |
343 | ||
344 | \constfunc{const wxBitmap\&}{GetBitmapPressed}{\void} | |
345 | ||
346 | Returns depressed button bitmap that has been set with | |
347 | \helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}. | |
348 | ||
349 | \wxheading{Return value} | |
350 | ||
351 | A reference to the depressed state bitmap. | |
352 | ||
353 | ||
7dc234d6 WS |
354 | \membersection{wxComboCtrl::GetButtonSize}\label{wxcomboctrlgetbuttonsize} |
355 | ||
356 | \func{wxSize}{GetButtonSize}{\void} | |
357 | ||
358 | Returns current size of the dropdown button. | |
359 | ||
360 | ||
0dfff674 WS |
361 | \membersection{wxComboCtrl::GetCustomPaintWidth}\label{wxcomboctrlgetcustompaintwidth} |
362 | ||
363 | \constfunc{int}{GetCustomPaintWidth}{\void} | |
364 | ||
365 | Returns custom painted area in control. | |
366 | ||
367 | \wxheading{See also} | |
368 | ||
369 | \helpref{wxComboCtrl::SetCustomPaintWidth}{wxcomboctrlsetcustompaintwidth}. | |
370 | ||
371 | ||
372 | \membersection{wxComboCtrl::GetFeatures}\label{wxcomboctrlgetfeatures} | |
373 | ||
374 | \func{static int}{GetFeatures}{\void} | |
375 | ||
376 | Returns features supported by wxComboCtrl. If needed feature is missing, | |
377 | you need to instead use wxGenericComboCtrl, which however may lack | |
378 | native look and feel (but otherwise sports identical API). | |
379 | ||
380 | \wxheading{Return value} | |
381 | ||
382 | Value returned is a combination of following flags: | |
383 | ||
384 | \twocolwidtha{8cm}% | |
385 | \begin{twocollist}\itemsep=0pt | |
386 | \twocolitem{{\tt wxComboCtrlFeatures::MovableButton}}{Button can | |
387 | be on either side of the control.} | |
388 | \twocolitem{{\tt wxComboCtrlFeatures::BitmapButton}}{Button may | |
389 | be replaced with bitmap.} | |
390 | \twocolitem{{\tt wxComboCtrlFeatures::ButtonSpacing}}{Button can | |
391 | have spacing.} | |
392 | \twocolitem{{\tt wxComboCtrlFeatures::TextIndent}}{SetTextIndent | |
393 | works.} | |
394 | \twocolitem{{\tt wxComboCtrlFeatures::PaintControl}}{Combo control | |
395 | itself can be custom painted.} | |
396 | \twocolitem{{\tt wxComboCtrlFeatures::PaintWritable}}{A variable- | |
397 | width area in front of writable combo control's textctrl can | |
398 | be custom painted.} | |
399 | \twocolitem{{\tt wxComboCtrlFeatures::Borderless}}{wxNO\_BORDER | |
400 | window style works.} | |
401 | \twocolitem{{\tt wxComboCtrlFeatures::All}}{All of the | |
402 | above.} | |
403 | \end{twocollist} | |
404 | ||
405 | ||
406 | \membersection{wxComboCtrl::GetInsertionPoint}\label{wxcomboctrlgetinsertionpoint} | |
407 | ||
408 | \constfunc{long}{GetInsertionPoint}{\void} | |
409 | ||
410 | Returns the insertion point for the combo control's text field. | |
411 | ||
412 | \textbf{Note:} Under wxMSW, this function always returns $0$ if the combo control | |
413 | doesn't have the focus. | |
414 | ||
415 | ||
974a12f8 RR |
416 | \membersection{wxComboCtrl::IsPopupWindowState}\label{wxcomboctrlispopupwindowstate} |
417 | ||
418 | \constfunc{bool}{IsPopupWindowState}{\param{int }{state}} | |
419 | ||
420 | Returns \true if the popup window is in the given state. | |
421 | Possible values are: | |
422 | \twocolwidtha{8cm}% | |
423 | \begin{twocollist}\itemsep=0pt | |
424 | \twocolitem{{\tt wxComboCtrl::Hidden}}{Popup window is hidden.} | |
425 | \twocolitem{{\tt wxComboCtrl::Animating}}{Popup window is being shown, but the | |
426 | popup animation has not yet finished.} | |
427 | \twocolitem{{\tt wxComboCtrl::Visible}}{Popup window is fully visible.} | |
428 | \end{twocollist} | |
429 | ||
430 | ||
431 | ||
0dfff674 WS |
432 | \membersection{wxComboCtrl::GetLastPosition}\label{wxcomboctrlgetlastposition} |
433 | ||
434 | \constfunc{long}{GetLastPosition}{\void} | |
435 | ||
436 | Returns the last position in the combo control text field. | |
437 | ||
438 | ||
439 | \membersection{wxComboCtrl::GetPopupControl}\label{wxcomboctrlgetpopupcontrol} | |
440 | ||
441 | \func{wxComboPopup*}{GetPopupControl}{\void} | |
442 | ||
443 | Returns current popup interface that has been set with SetPopupControl. | |
444 | ||
445 | ||
446 | \membersection{wxComboCtrl::GetPopupWindow}\label{wxcomboctrlgetpopupwindow} | |
447 | ||
448 | \constfunc{wxWindow*}{GetPopupWindow}{\void} | |
449 | ||
450 | Returns popup window containing the popup control. | |
451 | ||
452 | ||
453 | \membersection{wxComboCtrl::GetTextCtrl}\label{wxcomboctrlgettextctrl} | |
454 | ||
455 | \constfunc{wxTextCtrl*}{GetTextCtrl}{\void} | |
456 | ||
457 | Get the text control which is part of the combo control. | |
458 | ||
459 | ||
460 | \membersection{wxComboCtrl::GetTextIndent}\label{wxcomboctrlgettextindent} | |
461 | ||
462 | \constfunc{wxCoord}{GetTextIndent}{\void} | |
463 | ||
464 | Returns actual indentation in pixels. | |
465 | ||
466 | ||
df348ff8 RR |
467 | \membersection{wxComboCtrl::GetTextRect}\label{wxcomboctrlgettextrect} |
468 | ||
469 | \constfunc{const wxRect\&}{GetTextRect}{\void} | |
470 | ||
471 | Returns area covered by the text field (includes everything except | |
472 | borders and the dropdown button). | |
473 | ||
474 | ||
0dfff674 WS |
475 | \membersection{wxComboCtrl::GetValue}\label{wxcomboctrlgetvalue} |
476 | ||
477 | \constfunc{wxString}{GetValue}{\void} | |
478 | ||
479 | Returns text representation of the current value. For writable | |
480 | combo control it always returns the value in the text field. | |
481 | ||
482 | ||
483 | \membersection{wxComboCtrl::HidePopup}\label{wxcomboctrlhidepopup} | |
484 | ||
485 | \func{void}{HidePopup}{\void} | |
486 | ||
487 | Dismisses the popup window. | |
488 | ||
489 | ||
490 | \membersection{wxComboCtrl::IsPopupShown}\label{wxcomboctrlispopupshown} | |
491 | ||
492 | \constfunc{bool}{IsPopupShown}{\void} | |
493 | ||
494 | Returns \true if the popup is currently shown | |
495 | ||
496 | ||
497 | \membersection{wxComboCtrl::OnButtonClick}\label{wxcomboctrlonbuttonclick} | |
498 | ||
499 | \func{void}{OnButtonClick}{\void} | |
500 | ||
501 | Implement in a derived class to define what happens on | |
502 | dropdown button click. | |
503 | ||
504 | Default action is to show the popup. | |
505 | ||
df348ff8 RR |
506 | \textbf{Note:} If you implement this to do something else than |
507 | show the popup, you must then also implement | |
508 | \helpref{DoSetPopupControl}{wxcomboctrldosetpopupcontrol} to always | |
509 | return NULL. | |
510 | ||
0dfff674 WS |
511 | |
512 | \membersection{wxComboCtrl::Paste}\label{wxcomboctrlpaste} | |
513 | ||
514 | \func{void}{Paste}{\void} | |
515 | ||
516 | Pastes text from the clipboard to the text field. | |
517 | ||
518 | ||
519 | \membersection{wxComboCtrl::Remove}\label{wxcomboctrlremove} | |
520 | ||
521 | \func{void}{Remove}{\param{long }{from}, \param{long }{to}} | |
522 | ||
523 | Removes the text between the two positions in the combo control text field. | |
524 | ||
525 | \wxheading{Parameters} | |
526 | ||
527 | \docparam{from}{The first position.} | |
528 | ||
529 | \docparam{to}{The last position.} | |
530 | ||
531 | ||
532 | \membersection{wxComboCtrl::Replace}\label{wxcomboctrlreplace} | |
533 | ||
534 | \func{void}{Replace}{\param{long }{from}, \param{long }{to}, \param{const wxString\& }{value}} | |
535 | ||
536 | Replaces the text between two positions with the given text, in the combo control text field. | |
537 | ||
538 | \wxheading{Parameters} | |
539 | ||
540 | \docparam{from}{The first position.} | |
541 | ||
542 | \docparam{to}{The second position.} | |
543 | ||
544 | \docparam{text}{The text to insert.} | |
545 | ||
546 | ||
547 | \membersection{wxComboCtrl::SetButtonBitmaps}\label{wxcomboctrlsetbuttonbitmaps} | |
548 | ||
549 | \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}} | |
550 | ||
551 | Sets custom dropdown button graphics. | |
552 | ||
553 | \wxheading{Parameters} | |
554 | ||
555 | \docparam{bmpNormal}{Default button image.} | |
556 | \docparam{pushButtonBg}{If \true, blank push button background is painted | |
557 | below the image.} | |
558 | \docparam{bmpPressed}{Depressed button image.} | |
559 | \docparam{bmpHover}{Button image when mouse hovers above it. This | |
560 | should be ignored on platforms and themes that do not generally draw | |
561 | different kind of button on mouse hover.} | |
562 | \docparam{bmpDisabled}{Disabled button image.} | |
563 | ||
564 | ||
565 | \membersection{wxComboCtrl::SetButtonPosition}\label{wxcomboctrlsetbuttonposition} | |
566 | ||
7dc234d6 | 567 | \func{void}{SetButtonPosition}{\param{int }{width = -1}, \param{int }{height = -1}, \param{int }{side = wxRIGHT}, \param{int }{spacingX = 0}} |
0dfff674 WS |
568 | |
569 | Sets size and position of dropdown button. | |
570 | ||
571 | \wxheading{Parameters} | |
572 | ||
7dc234d6 WS |
573 | \docparam{width}{Button width. Value <= $0$ specifies default.} |
574 | \docparam{height}{Button height. Value <= $0$ specifies default.} | |
0dfff674 WS |
575 | \docparam{side}{Indicates which side the button will be placed. |
576 | Value can be {\tt wxLEFT} or {\tt wxRIGHT}.} | |
577 | \docparam{spacingX}{Horizontal spacing around the button. Default is $0$.} | |
578 | ||
579 | ||
580 | \membersection{wxComboCtrl::SetCustomPaintWidth}\label{wxcomboctrlsetcustompaintwidth} | |
581 | ||
582 | \func{void}{SetCustomPaintWidth}{\param{int }{width}} | |
583 | ||
584 | Set width, in pixels, of custom painted area in control without {\tt wxCB\_READONLY} | |
585 | style. In read-only \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}, this is used | |
586 | to indicate area that is not covered by the focus rectangle. | |
587 | ||
588 | ||
589 | \membersection{wxComboCtrl::SetInsertionPoint}\label{wxcomboctrlsetinsertionpoint} | |
590 | ||
591 | \func{void}{SetInsertionPoint}{\param{long }{pos}} | |
592 | ||
593 | Sets the insertion point in the text field. | |
594 | ||
595 | \wxheading{Parameters} | |
596 | ||
597 | \docparam{pos}{The new insertion point.} | |
598 | ||
599 | ||
600 | \membersection{wxComboCtrl::SetInsertionPointEnd}\label{wxcomboctrlsetinsertionpointend} | |
601 | ||
602 | \func{void}{SetInsertionPointEnd}{\void} | |
603 | ||
604 | Sets the insertion point at the end of the combo control text field. | |
605 | ||
606 | ||
607 | \membersection{wxComboCtrl::SetPopupAnchor}\label{wxcomboctrlsetpopupanchor} | |
608 | ||
609 | \func{void}{SetPopupAnchor}{\param{int }{anchorSide}} | |
610 | ||
611 | Set side of the control to which the popup will align itself. Valid values are | |
612 | {\tt wxLEFT}, {\tt wxRIGHT} and $0$. The default value $0$ means that the most appropriate | |
613 | side is used (which, currently, is always {\tt wxLEFT}). | |
614 | ||
615 | ||
616 | \membersection{wxComboCtrl::SetPopupControl}\label{wxcomboctrlsetpopupcontrol} | |
617 | ||
618 | \func{void}{SetPopupControl}{\param{wxComboPopup* }{popup}} | |
619 | ||
620 | Set popup interface class derived from wxComboPopup. | |
621 | This method should be called as soon as possible after the control | |
622 | has been created, unless \helpref{OnButtonClick}{wxcomboctrlonbuttonclick} | |
623 | has been overridden. | |
624 | ||
625 | ||
626 | \membersection{wxComboCtrl::SetPopupExtents}\label{wxcomboctrlsetpopupextents} | |
627 | ||
628 | \func{void}{SetPopupExtents}{\param{int }{extLeft}, \param{int }{extRight}} | |
629 | ||
630 | Extends popup size horizontally, relative to the edges of the combo control. | |
631 | ||
632 | \wxheading{Parameters} | |
633 | ||
634 | \docparam{extLeft}{How many pixel to extend beyond the left edge of the | |
635 | control. Default is $0$.} | |
636 | \docparam{extRight}{How many pixel to extend beyond the right edge of the | |
637 | control. Default is $0$.} | |
638 | ||
639 | \wxheading{Remarks} | |
640 | ||
641 | Popup minimum width may override arguments. | |
642 | ||
643 | It is up to the popup to fully take this into account. | |
644 | ||
645 | ||
646 | \membersection{wxComboCtrl::SetPopupMaxHeight}\label{wxcomboctrlsetpopupmaxheight} | |
647 | ||
648 | \func{void}{SetPopupMaxHeight}{\param{int }{height}} | |
649 | ||
650 | Sets preferred maximum height of the popup. | |
651 | ||
652 | \wxheading{Remarks} | |
653 | ||
654 | Value -1 indicates the default. | |
655 | ||
656 | Also, popup implementation may choose to ignore this. | |
657 | ||
658 | ||
659 | \membersection{wxComboCtrl::SetPopupMinWidth}\label{wxcomboctrlsetpopupminwidth} | |
660 | ||
661 | \func{void}{SetPopupMinWidth}{\param{int }{width}} | |
662 | ||
663 | Sets minimum width of the popup. If wider than combo control, it will extend to the left. | |
664 | ||
665 | \wxheading{Remarks} | |
666 | ||
667 | Value -1 indicates the default. | |
668 | ||
669 | Also, popup implementation may choose to ignore this. | |
670 | ||
671 | ||
672 | \membersection{wxComboCtrl::SetSelection}\label{wxcomboctrlsetselection} | |
673 | ||
674 | \func{void}{SetSelection}{\param{long }{from}, \param{long }{to}} | |
675 | ||
676 | Selects the text between the two positions, in the combo control text field. | |
677 | ||
678 | \wxheading{Parameters} | |
679 | ||
680 | \docparam{from}{The first position.} | |
681 | ||
682 | \docparam{to}{The second position.} | |
683 | ||
684 | ||
685 | \membersection{wxComboCtrl::SetText}\label{wxcomboctrlsettext} | |
686 | ||
687 | \func{void}{SetText}{\param{const wxString\& }{value}} | |
688 | ||
689 | Sets the text for the text field without affecting the | |
690 | popup. Thus, unlike \helpref{SetValue}{wxcomboctrlsetvalue}, it works | |
691 | equally well with combo control using {\tt wxCB\_READONLY} style. | |
692 | ||
693 | ||
694 | \membersection{wxComboCtrl::SetTextIndent}\label{wxcomboctrlsettextindent} | |
695 | ||
696 | \func{void}{SetTextIndent}{\param{int }{indent}} | |
697 | ||
698 | This will set the space in pixels between left edge of the control and the | |
699 | text, regardless whether control is read-only or not. Value -1 can be | |
700 | given to indicate platform default. | |
701 | ||
702 | ||
703 | \membersection{wxComboCtrl::SetValue}\label{wxcomboctrlsetvalue} | |
704 | ||
705 | \func{void}{SetValue}{\param{const wxString\& }{value}} | |
706 | ||
707 | Sets the text for the combo control text field. | |
708 | ||
709 | {\bf NB:} For a combo control with {\tt wxCB\_READONLY} style the | |
710 | string must be accepted by the popup (for instance, exist in the dropdown | |
711 | list), otherwise the call to SetValue() is ignored | |
712 | ||
713 | ||
df348ff8 RR |
714 | \membersection{wxComboCtrl::SetValueWithEvent}\label{wxcomboctrlsetvaluewithevent} |
715 | ||
716 | \func{void}{SetValueWithEvent}{\param{const wxString\& }{value}, \param{bool }{withEvent = true}} | |
717 | ||
718 | Same as SetValue, but also sends wxCommandEvent of type wxEVT\_COMMAND\_TEXT\_UPDATED | |
719 | if {\tt withEvent} is \true. | |
720 | ||
721 | ||
0dfff674 WS |
722 | \membersection{wxComboCtrl::ShowPopup}\label{wxcomboctrlshowpopup} |
723 | ||
724 | \func{void}{ShowPopup}{\void} | |
725 | ||
726 | Show the popup. | |
727 | ||
728 | ||
729 | \membersection{wxComboCtrl::Undo}\label{wxcomboctrlundo} | |
730 | ||
731 | \func{void}{Undo}{\void} | |
732 | ||
733 | Undoes the last edit in the text field. Windows only. | |
b67a86d5 | 734 | |
06077aaf VZ |
735 | |
736 | \membersection{wxComboCtrl::UseAltPopupWindow}\label{wxcomboctrlusealtpopupwindow} | |
737 | ||
738 | \func{void}{UseAltPopupWindow}{\param{bool }{enable = true}} | |
739 | ||
740 | Enable or disable usage of an alternative popup window, which guarantees | |
741 | ability to focus the popup control, and allows common native controls to | |
742 | function normally. This alternative popup window is usually a wxDialog, | |
743 | and as such, when it is shown, its parent top-level window will appear | |
744 | as if the focus has been lost from it. | |
745 | ||
746 |