File: comboctrl.tex

package info (click to toggle)
wxwidgets2.8 2.8.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 239,052 kB
  • ctags: 289,550
  • sloc: cpp: 1,838,857; xml: 396,717; python: 282,506; ansic: 126,171; makefile: 51,406; sh: 14,581; asm: 299; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 39; lisp: 38; tcl: 24; haskell: 20; java: 18; cs: 18; erlang: 17; ruby: 16; ada: 9; ml: 9; csh: 9
file content (747 lines) | stat: -rw-r--r-- 23,086 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name:        comboctrl.tex
%% Purpose:     wxComboCtrl docs
%% Author:      Jaakko Salli
%% Modified by:
%% Created:
%% RCS-ID:      $Id: comboctrl.tex 58657 2009-02-04 17:56:42Z JMS $
%% Copyright:   (c) Jaakko Salli
%% License:     wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{\class{wxComboCtrl}}\label{wxcomboctrl}

A combo control is a generic combobox that allows totally
custom popup. In addition it has other customization features.
For instance, position and size of the dropdown button
can be changed.

\wxheading{Setting Custom Popup for wxComboCtrl}

wxComboCtrl needs to be told somehow which control to use
and this is done by SetPopupControl(). However, we need
something more than just a wxControl in this method as,
for example, we need to call SetStringValue("initial text value")
and wxControl doesn't have such method. So we also need a
\helpref{wxComboPopup}{wxcombopopup} which is an interface which
must be implemented by a control to be usable as a popup.

We couldn't derive wxComboPopup from wxControl as this would make it
impossible to have a class deriving from a wxWidgets control and from
it, so instead it is just a mix-in.

Here's a minimal sample of \helpref{wxListView}{wxlistview} popup:

\begin{verbatim}

#include <wx/combo.h>
#include <wx/listctrl.h>

class wxListViewComboPopup : public wxListView,
                             public wxComboPopup
{
public:

    // Initialize member variables
    virtual void Init()
    {
        m_value = -1;
    }

    // Create popup control
    virtual bool Create(wxWindow* parent)
    {
        return wxListView::Create(parent,1,wxPoint(0,0),wxDefaultSize);
    }

    // Return pointer to the created control
    virtual wxWindow *GetControl() { return this; }

    // Translate string into a list selection
    virtual void SetStringValue(const wxString& s)
    {
        int n = wxListView::FindItem(-1,s);
        if ( n >= 0 && n < wxListView::GetItemCount() )
            wxListView::Select(n);
    }

    // Get list selection as a string
    virtual wxString GetStringValue() const
    {
        if ( m_value >= 0 )
            return wxListView::GetItemText(m_value);
        return wxEmptyString;
    }

    // Do mouse hot-tracking (which is typical in list popups)
    void OnMouseMove(wxMouseEvent& event)
    {
        // TODO: Move selection to cursor
    }

    // On mouse left up, set the value and close the popup
    void OnMouseClick(wxMouseEvent& WXUNUSED(event))
    {
        m_value = wxListView::GetFirstSelected();

        // TODO: Send event as well

        Dismiss();
    }

protected:

    int             m_value; // current item index

private:
    DECLARE_EVENT_TABLE()
};

BEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView)
    EVT_MOTION(wxListViewComboPopup::OnMouseMove)
    EVT_LEFT_UP(wxListViewComboPopup::OnMouseClick)
END_EVENT_TABLE()

\end{verbatim}

Here's how you would create and populate it in a dialog constructor:

\begin{verbatim}

    wxComboCtrl* comboCtrl = new wxComboCtrl(this,wxID_ANY,wxEmptyString);

    wxListViewComboPopup* popupCtrl = new wxListViewComboPopup();

    // It is important to call SetPopupControl() as soon as possible
    comboCtrl->SetPopupControl(popupCtrl);

    // Populate using wxListView methods
    popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("First Item"));
    popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("Second Item"));
    popupCtrl->InsertItem(popupCtrl->GetItemCount(),wxT("Third Item"));

\end{verbatim}

\wxheading{Derived from}

\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<combo.h>

\wxheading{Window styles}

\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxCB\_READONLY}}{Text will not be editable.}
\twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries in the list alphabetically.}
\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate
the event wxEVT\_COMMAND\_TEXT\_ENTER (otherwise pressing Enter key
is either processed internally by the control or used for navigation between
dialog controls). Windows only.}
\twocolitem{\windowstyle{wxCC\_SPECIAL\_DCLICK}}{Double-clicking triggers a call
to popup's OnComboDoubleClick. Actual behaviour is defined by a derived
class. For instance, wxOwnerDrawnComboBox will cycle an item. This style only
applies if wxCB\_READONLY is used as well.}
\twocolitem{\windowstyle{wxCC\_STD\_BUTTON}}{Drop button will behave
more like a standard push button.}
\end{twocollist}

See also \helpref{window styles overview}{windowstyles}.

\wxheading{Event handling}

\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event,
when the text changes.}
\twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_ENTER event,
when <RETURN> is pressed in the combo control.}
\end{twocollist}

\wxheading{See also}

\helpref{wxComboBox}{wxcombobox}, \helpref{wxChoice}{wxchoice},
\helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox},
\rtfsp\helpref{wxComboPopup}{wxcombopopup}, \helpref{wxCommandEvent}{wxcommandevent}

\latexignore{\rtfignore{\wxheading{Members}}}


\membersection{wxComboCtrl::wxComboCtrl}\label{wxcomboctrlctor}

\func{}{wxComboCtrl}{\void}

Default constructor.

\func{}{wxComboCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboCtrl"}}

Constructor, creating and showing a combo control.

\wxheading{Parameters}

\docparam{parent}{Parent window. Must not be NULL.}

\docparam{id}{Window identifier. A value of -1 indicates a default value.}

\docparam{value}{Initial selection string. An empty string indicates no selection.}

\docparam{pos}{Window position.}

\docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized
appropriately.}

\docparam{style}{Window style. See \helpref{wxComboCtrl}{wxcomboctrl}.}

\docparam{validator}{Window validator.}

\docparam{name}{Window name.}

\wxheading{See also}

\helpref{wxComboCtrl::Create}{wxcomboctrlcreate}, \helpref{wxValidator}{wxvalidator}


\membersection{wxComboCtrl::\destruct{wxComboCtrl}}\label{wxcomboctrldtor}

\func{}{\destruct{wxComboCtrl}}{\void}

Destructor, destroying the combo control.


\membersection{wxComboCtrl::AnimateShow}\label{wxcomboctrlanimateshow}

\func{virtual bool}{AnimateShow}{\param{const wxRect\& }{rect}, \param{int }{flags}}

This member function is not normally called in application code.
Instead, it can be implemented in a derived class to create a
custom popup animation.

\wxheading{Parameters}

Same as in \helpref{DoShowPopup}{wxcomboctrldoshowpopup}.

\wxheading{Return value}

\true if animation finishes before the function returns.
\false otherwise. In the latter case you need to manually call DoShowPopup
after the animation ends.


\membersection{wxComboCtrl::Create}\label{wxcomboctrlcreate}

\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboCtrl"}}

Creates the combo control for two-step construction. Derived classes
should call or replace this function. See \helpref{wxComboCtrl::wxComboCtrl}{wxcomboctrlctor}\rtfsp
for further details.


\membersection{wxComboCtrl::Copy}\label{wxcomboctrlcopy}

\func{void}{Copy}{\void}

Copies the selected text to the clipboard.


\membersection{wxComboCtrl::Cut}\label{wxcomboctrlcut}

\func{void}{Cut}{\void}

Copies the selected text to the clipboard and removes the selection.


\membersection{wxComboCtrl::DoSetPopupControl}\label{wxcomboctrldosetpopupcontrol}

\func{void}{DoSetPopupControl}{\param{wxComboPopup* }{popup}}

This member function is not normally called in application code.
Instead, it can be implemented in a derived class to return
default wxComboPopup, incase {\tt popup} is NULL.

\textbf{Note:} If you have implemented OnButtonClick to do
something else than show the popup, then DoSetPopupControl
must always return NULL.


\membersection{wxComboCtrl::DoShowPopup}\label{wxcomboctrldoshowpopup}

\func{virtual void}{DoShowPopup}{\param{const wxRect\& }{rect}, \param{int }{flags}}

This member function is not normally called in application code.
Instead, it must be called in a derived class to make sure popup
is properly shown after a popup animation has finished (but only
if \helpref{AnimateShow}{wxcomboctrlanimateshow} did not finish
the animation within it's function scope).

\wxheading{Parameters}

\docparam{rect}{Position to show the popup window at, in screen coordinates.}

\docparam{flags}{Combination of any of the following:}
\twocolwidtha{8cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{{\tt wxComboCtrl::ShowAbove}}{Popup is shown above the control instead
of below.}
\twocolitem{{\tt wxComboCtrl::CanDeferShow}}{Showing the popup can be deferred
to happen sometime after \helpref{ShowPopup}{wxcomboctrlshowpopup} has finished.
In this case, \helpref{AnimateShow}{wxcomboctrlanimateshow} must return \false.}
\end{twocollist}


\membersection{wxComboCtrl::EnablePopupAnimation}\label{wxcomboctrlenablepopupanimation}

\func{void}{EnablePopupAnimation}{\param{bool }{enable = true}}

Enables or disables popup animation, if any, depending on the value of
the argument.


\membersection{wxComboCtrl::GetBitmapDisabled}\label{wxcomboctrlgetbitmapdisabled}

\constfunc{const wxBitmap\&}{GetBitmapDisabled}{\void}

Returns disabled button bitmap that has been set with
\helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}.

\wxheading{Return value}

A reference to the disabled state bitmap.


\membersection{wxComboCtrl::GetBitmapHover}\label{wxcomboctrlgetbitmaphover}

\constfunc{const wxBitmap\&}{GetBitmapHover}{\void}

Returns button mouse hover bitmap that has been set with
\helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}.

\wxheading{Return value}

A reference to the mouse hover state bitmap.


\membersection{wxComboCtrl::GetBitmapNormal}\label{wxcomboctrlgetbitmapnormal}

\constfunc{const wxBitmap\&}{GetBitmapNormal}{\void}

Returns default button bitmap that has been set with
\helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}.

\wxheading{Return value}

A reference to the normal state bitmap.


\membersection{wxComboCtrl::GetBitmapPressed}\label{wxcomboctrlgetbitmappressed}

\constfunc{const wxBitmap\&}{GetBitmapPressed}{\void}

Returns depressed button bitmap that has been set with
\helpref{SetButtonBitmaps}{wxcomboctrlsetbuttonbitmaps}.

\wxheading{Return value}

A reference to the depressed state bitmap.


\membersection{wxComboCtrl::GetButtonSize}\label{wxcomboctrlgetbuttonsize}

\func{wxSize}{GetButtonSize}{\void}

Returns current size of the dropdown button.


\membersection{wxComboCtrl::GetCustomPaintWidth}\label{wxcomboctrlgetcustompaintwidth}

\constfunc{int}{GetCustomPaintWidth}{\void}

Returns custom painted area in control.

\wxheading{See also}

\helpref{wxComboCtrl::SetCustomPaintWidth}{wxcomboctrlsetcustompaintwidth}.


\membersection{wxComboCtrl::GetFeatures}\label{wxcomboctrlgetfeatures}

\func{static int}{GetFeatures}{\void}

Returns features supported by wxComboCtrl. If needed feature is missing,
you need to instead use wxGenericComboCtrl, which however may lack
native look and feel (but otherwise sports identical API).

\wxheading{Return value}

Value returned is a combination of following flags:

\twocolwidtha{8cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{{\tt wxComboCtrlFeatures::MovableButton}}{Button can
be on either side of the control.}
\twocolitem{{\tt wxComboCtrlFeatures::BitmapButton}}{Button may
be replaced with bitmap.}
\twocolitem{{\tt wxComboCtrlFeatures::ButtonSpacing}}{Button can
have spacing.}
\twocolitem{{\tt wxComboCtrlFeatures::TextIndent}}{SetTextIndent
works.}
\twocolitem{{\tt wxComboCtrlFeatures::PaintControl}}{Combo control
itself can be custom painted.}
\twocolitem{{\tt wxComboCtrlFeatures::PaintWritable}}{A variable-
width area in front of writable combo control's textctrl can
be custom painted.}
\twocolitem{{\tt wxComboCtrlFeatures::Borderless}}{wxNO\_BORDER
window style works.}
\twocolitem{{\tt wxComboCtrlFeatures::All}}{All of the
above.}
\end{twocollist}


\membersection{wxComboCtrl::GetInsertionPoint}\label{wxcomboctrlgetinsertionpoint}

\constfunc{long}{GetInsertionPoint}{\void}

Returns the insertion point for the combo control's text field.

\textbf{Note:} Under wxMSW, this function always returns $0$ if the combo control
doesn't have the focus.


\membersection{wxComboCtrl::IsPopupWindowState}\label{wxcomboctrlispopupwindowstate}

\constfunc{bool}{IsPopupWindowState}{\param{int }{state}}

Returns \true if the popup window is in the given state.
Possible values are:
\twocolwidtha{8cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{{\tt wxComboCtrl::Hidden}}{Popup window is hidden.}
\twocolitem{{\tt wxComboCtrl::Animating}}{Popup window is being shown, but the
popup animation has not yet finished.}
\twocolitem{{\tt wxComboCtrl::Visible}}{Popup window is fully visible.}
\end{twocollist}



\membersection{wxComboCtrl::GetLastPosition}\label{wxcomboctrlgetlastposition}

\constfunc{long}{GetLastPosition}{\void}

Returns the last position in the combo control text field.


\membersection{wxComboCtrl::GetPopupControl}\label{wxcomboctrlgetpopupcontrol}

\func{wxComboPopup*}{GetPopupControl}{\void}

Returns current popup interface that has been set with SetPopupControl.


\membersection{wxComboCtrl::GetPopupWindow}\label{wxcomboctrlgetpopupwindow}

\constfunc{wxWindow*}{GetPopupWindow}{\void}

Returns popup window containing the popup control.


\membersection{wxComboCtrl::GetTextCtrl}\label{wxcomboctrlgettextctrl}

\constfunc{wxTextCtrl*}{GetTextCtrl}{\void}

Get the text control which is part of the combo control.


\membersection{wxComboCtrl::GetTextIndent}\label{wxcomboctrlgettextindent}

\constfunc{wxCoord}{GetTextIndent}{\void}

Returns actual indentation in pixels.


\membersection{wxComboCtrl::GetTextRect}\label{wxcomboctrlgettextrect}

\constfunc{const wxRect\&}{GetTextRect}{\void}

Returns area covered by the text field (includes everything except
borders and the dropdown button).


\membersection{wxComboCtrl::GetValue}\label{wxcomboctrlgetvalue}

\constfunc{wxString}{GetValue}{\void}

Returns text representation of the current value. For writable
combo control it always returns the value in the text field.


\membersection{wxComboCtrl::HidePopup}\label{wxcomboctrlhidepopup}

\func{void}{HidePopup}{\void}

Dismisses the popup window.


\membersection{wxComboCtrl::IsPopupShown}\label{wxcomboctrlispopupshown}

\constfunc{bool}{IsPopupShown}{\void}

Returns \true if the popup is currently shown


\membersection{wxComboCtrl::OnButtonClick}\label{wxcomboctrlonbuttonclick}

\func{void}{OnButtonClick}{\void}

Implement in a derived class to define what happens on
dropdown button click.

Default action is to show the popup.

\textbf{Note:} If you implement this to do something else than
show the popup, you must then also implement
\helpref{DoSetPopupControl}{wxcomboctrldosetpopupcontrol} to always
return NULL.


\membersection{wxComboCtrl::Paste}\label{wxcomboctrlpaste}

\func{void}{Paste}{\void}

Pastes text from the clipboard to the text field.


\membersection{wxComboCtrl::Remove}\label{wxcomboctrlremove}

\func{void}{Remove}{\param{long }{from}, \param{long }{to}}

Removes the text between the two positions in the combo control text field.

\wxheading{Parameters}

\docparam{from}{The first position.}

\docparam{to}{The last position.}


\membersection{wxComboCtrl::Replace}\label{wxcomboctrlreplace}

\func{void}{Replace}{\param{long }{from}, \param{long }{to}, \param{const wxString\& }{value}}

Replaces the text between two positions with the given text, in the combo control text field.

\wxheading{Parameters}

\docparam{from}{The first position.}

\docparam{to}{The second position.}

\docparam{text}{The text to insert.}


\membersection{wxComboCtrl::SetButtonBitmaps}\label{wxcomboctrlsetbuttonbitmaps}

\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}}

Sets custom dropdown button graphics.

\wxheading{Parameters}

\docparam{bmpNormal}{Default button image.}
\docparam{pushButtonBg}{If \true, blank push button background is painted
below the image.}
\docparam{bmpPressed}{Depressed button image.}
\docparam{bmpHover}{Button image when mouse hovers above it. This
should be ignored on platforms and themes that do not generally draw
different kind of button on mouse hover.}
\docparam{bmpDisabled}{Disabled button image.}


\membersection{wxComboCtrl::SetButtonPosition}\label{wxcomboctrlsetbuttonposition}

\func{void}{SetButtonPosition}{\param{int }{width = -1}, \param{int }{height = -1}, \param{int }{side = wxRIGHT}, \param{int }{spacingX = 0}}

Sets size and position of dropdown button.

\wxheading{Parameters}

\docparam{width}{Button width. Value <= $0$ specifies default.}
\docparam{height}{Button height. Value <= $0$ specifies default.}
\docparam{side}{Indicates which side the button will be placed.
Value can be {\tt wxLEFT} or {\tt wxRIGHT}.}
\docparam{spacingX}{Horizontal spacing around the button. Default is $0$.}


\membersection{wxComboCtrl::SetCustomPaintWidth}\label{wxcomboctrlsetcustompaintwidth}

\func{void}{SetCustomPaintWidth}{\param{int }{width}}

Set width, in pixels, of custom painted area in control without {\tt wxCB\_READONLY}
style. In read-only \helpref{wxOwnerDrawnComboBox}{wxownerdrawncombobox}, this is used
to indicate area that is not covered by the focus rectangle.


\membersection{wxComboCtrl::SetInsertionPoint}\label{wxcomboctrlsetinsertionpoint}

\func{void}{SetInsertionPoint}{\param{long }{pos}}

Sets the insertion point in the text field.

\wxheading{Parameters}

\docparam{pos}{The new insertion point.}


\membersection{wxComboCtrl::SetInsertionPointEnd}\label{wxcomboctrlsetinsertionpointend}

\func{void}{SetInsertionPointEnd}{\void}

Sets the insertion point at the end of the combo control text field.


\membersection{wxComboCtrl::SetPopupAnchor}\label{wxcomboctrlsetpopupanchor}

\func{void}{SetPopupAnchor}{\param{int }{anchorSide}}

Set side of the control to which the popup will align itself. Valid values are
{\tt wxLEFT}, {\tt wxRIGHT} and $0$. The default value $0$ means that the most appropriate
side is used (which, currently, is always {\tt wxLEFT}).


\membersection{wxComboCtrl::SetPopupControl}\label{wxcomboctrlsetpopupcontrol}

\func{void}{SetPopupControl}{\param{wxComboPopup* }{popup}}

Set popup interface class derived from wxComboPopup.
This method should be called as soon as possible after the control
has been created, unless \helpref{OnButtonClick}{wxcomboctrlonbuttonclick}
has been overridden.


\membersection{wxComboCtrl::SetPopupExtents}\label{wxcomboctrlsetpopupextents}

\func{void}{SetPopupExtents}{\param{int }{extLeft}, \param{int }{extRight}}

Extends popup size horizontally, relative to the edges of the combo control.

\wxheading{Parameters}

\docparam{extLeft}{How many pixel to extend beyond the left edge of the
control. Default is $0$.}
\docparam{extRight}{How many pixel to extend beyond the right edge of the
control. Default is $0$.}

\wxheading{Remarks}

Popup minimum width may override arguments.

It is up to the popup to fully take this into account.


\membersection{wxComboCtrl::SetPopupMaxHeight}\label{wxcomboctrlsetpopupmaxheight}

\func{void}{SetPopupMaxHeight}{\param{int }{height}}

Sets preferred maximum height of the popup.

\wxheading{Remarks}

Value -1 indicates the default.

Also, popup implementation may choose to ignore this.


\membersection{wxComboCtrl::SetPopupMinWidth}\label{wxcomboctrlsetpopupminwidth}

\func{void}{SetPopupMinWidth}{\param{int }{width}}

Sets minimum width of the popup. If wider than combo control, it will extend to the left.

\wxheading{Remarks}

Value -1 indicates the default.

Also, popup implementation may choose to ignore this.


\membersection{wxComboCtrl::SetSelection}\label{wxcomboctrlsetselection}

\func{void}{SetSelection}{\param{long }{from}, \param{long }{to}}

Selects the text between the two positions, in the combo control text field.

\wxheading{Parameters}

\docparam{from}{The first position.}

\docparam{to}{The second position.}


\membersection{wxComboCtrl::SetText}\label{wxcomboctrlsettext}

\func{void}{SetText}{\param{const wxString\& }{value}}

Sets the text for the text field without affecting the
popup. Thus, unlike \helpref{SetValue}{wxcomboctrlsetvalue}, it works
equally well with combo control using {\tt wxCB\_READONLY} style.


\membersection{wxComboCtrl::SetTextIndent}\label{wxcomboctrlsettextindent}

\func{void}{SetTextIndent}{\param{int }{indent}}

This will set the space in pixels between left edge of the control and the
text, regardless whether control is read-only or not. Value -1 can be
given to indicate platform default.


\membersection{wxComboCtrl::SetValue}\label{wxcomboctrlsetvalue}

\func{void}{SetValue}{\param{const wxString\& }{value}}

Sets the text for the combo control text field.

{\bf NB:} For a combo control with {\tt wxCB\_READONLY} style the
string must be accepted by the popup (for instance, exist in the dropdown
list), otherwise the call to SetValue() is ignored


\membersection{wxComboCtrl::SetValueWithEvent}\label{wxcomboctrlsetvaluewithevent}

\func{void}{SetValueWithEvent}{\param{const wxString\& }{value}, \param{bool }{withEvent = true}}

Same as SetValue, but also sends wxCommandEvent of type wxEVT\_COMMAND\_TEXT\_UPDATED
if {\tt withEvent} is \true.


\membersection{wxComboCtrl::ShowPopup}\label{wxcomboctrlshowpopup}

\func{void}{ShowPopup}{\void}

Show the popup.


\membersection{wxComboCtrl::Undo}\label{wxcomboctrlundo}

\func{void}{Undo}{\void}

Undoes the last edit in the text field. Windows only.


\membersection{wxComboCtrl::UseAltPopupWindow}\label{wxcomboctrlusealtpopupwindow}

\func{void}{UseAltPopupWindow}{\param{bool }{enable = true}}

Enable or disable usage of an alternative popup window, which guarantees
ability to focus the popup control, and allows common native controls to
function normally. This alternative popup window is usually a wxDialog,
and as such, when it is shown, its parent top-level window will appear
as if the focus has been lost from it.