]> git.saurik.com Git - wxWidgets.git/blob - samples/widgets/combobox.cpp
cleanup
[wxWidgets.git] / samples / widgets / combobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Program: wxWidgets Widgets Sample
3 // Name: combobox.cpp
4 // Purpose: Part of the widgets sample showing wxComboBox
5 // Author: Vadim Zeitlin
6 // Created: 27.03.01
7 // Id: $Id$
8 // Copyright: (c) 2001 Vadim Zeitlin
9 // License: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // for compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_COMBOBOX
28
29 // for all others, include the necessary headers
30 #ifndef WX_PRECOMP
31 #include "wx/log.h"
32
33 #include "wx/bitmap.h"
34 #include "wx/button.h"
35 #include "wx/checkbox.h"
36 #include "wx/combobox.h"
37 #include "wx/radiobox.h"
38 #include "wx/statbox.h"
39 #include "wx/textctrl.h"
40 #endif
41
42 #include "wx/sizer.h"
43
44 #include "itemcontainer.h"
45 #include "widgets.h"
46 #if 1
47 #include "icons/combobox.xpm"
48
49 // ----------------------------------------------------------------------------
50 // constants
51 // ----------------------------------------------------------------------------
52
53 // control ids
54 enum
55 {
56 ComboPage_Reset = wxID_HIGHEST,
57 ComboPage_SetCurrent,
58 ComboPage_CurText,
59 ComboPage_InsertionPointText,
60 ComboPage_Insert,
61 ComboPage_InsertText,
62 ComboPage_Add,
63 ComboPage_AddText,
64 ComboPage_AddSeveral,
65 ComboPage_AddMany,
66 ComboPage_Clear,
67 ComboPage_Change,
68 ComboPage_ChangeText,
69 ComboPage_Delete,
70 ComboPage_DeleteText,
71 ComboPage_DeleteSel,
72 ComboPage_SetValue,
73 ComboPage_SetValueText,
74 ComboPage_Combo,
75 ComboPage_ContainerTests
76 };
77
78 // kinds of comboboxes
79 enum
80 {
81 ComboKind_Default,
82 ComboKind_Simple,
83 ComboKind_DropDown
84 };
85
86 // ----------------------------------------------------------------------------
87 // ComboboxWidgetsPage
88 // ----------------------------------------------------------------------------
89
90 class ComboboxWidgetsPage : public ItemContainerWidgetsPage
91 {
92 public:
93 ComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
94
95 virtual wxControl *GetWidget() const { return m_combobox; }
96 virtual wxItemContainer* GetContainer() const { return m_combobox; }
97 virtual void RecreateWidget() { CreateCombo(); }
98
99 // lazy creation of the content
100 virtual void CreateContent();
101
102 protected:
103 // event handlers
104 void OnButtonReset(wxCommandEvent& event);
105 void OnButtonChange(wxCommandEvent& event);
106 void OnButtonDelete(wxCommandEvent& event);
107 void OnButtonDeleteSel(wxCommandEvent& event);
108 void OnButtonClear(wxCommandEvent& event);
109 void OnButtonInsert(wxCommandEvent &event);
110 void OnButtonAdd(wxCommandEvent& event);
111 void OnButtonAddSeveral(wxCommandEvent& event);
112 void OnButtonAddMany(wxCommandEvent& event);
113 void OnButtonSetValue(wxCommandEvent& event);
114 void OnButtonSetCurrent(wxCommandEvent& event);
115
116 void OnComboBox(wxCommandEvent& event);
117 void OnComboText(wxCommandEvent& event);
118
119 void OnCheckOrRadioBox(wxCommandEvent& event);
120
121 void OnUpdateUIInsertionPointText(wxUpdateUIEvent& event);
122
123 void OnUpdateUIInsert(wxUpdateUIEvent& event);
124 void OnUpdateUIAddSeveral(wxUpdateUIEvent& event);
125 void OnUpdateUIClearButton(wxUpdateUIEvent& event);
126 void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
127 void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
128 void OnUpdateUIResetButton(wxUpdateUIEvent& event);
129 void OnUpdateUISetCurrent(wxUpdateUIEvent& event);
130
131 // reset the combobox parameters
132 void Reset();
133
134 // (re)create the combobox
135 void CreateCombo();
136
137 // the controls
138 // ------------
139
140 // the sel mode radiobox
141 wxRadioBox *m_radioKind;
142
143 // the checkboxes for styles
144 wxCheckBox *m_chkSort,
145 *m_chkReadonly,
146 *m_chkFilename;
147
148 // the combobox itself and the sizer it is in
149 wxComboBox *m_combobox;
150 wxSizer *m_sizerCombo;
151
152 // the text entries for "Add/change string" and "Delete" buttons
153 wxTextCtrl *m_textInsert,
154 *m_textAdd,
155 *m_textChange,
156 *m_textSetValue,
157 *m_textDelete,
158 *m_textCur;
159
160 private:
161 DECLARE_EVENT_TABLE()
162 DECLARE_WIDGETS_PAGE(ComboboxWidgetsPage)
163 };
164
165 // ----------------------------------------------------------------------------
166 // event tables
167 // ----------------------------------------------------------------------------
168
169 BEGIN_EVENT_TABLE(ComboboxWidgetsPage, WidgetsPage)
170 EVT_BUTTON(ComboPage_Reset, ComboboxWidgetsPage::OnButtonReset)
171 EVT_BUTTON(ComboPage_Change, ComboboxWidgetsPage::OnButtonChange)
172 EVT_BUTTON(ComboPage_Delete, ComboboxWidgetsPage::OnButtonDelete)
173 EVT_BUTTON(ComboPage_DeleteSel, ComboboxWidgetsPage::OnButtonDeleteSel)
174 EVT_BUTTON(ComboPage_Clear, ComboboxWidgetsPage::OnButtonClear)
175 EVT_BUTTON(ComboPage_Insert, ComboboxWidgetsPage::OnButtonInsert)
176 EVT_BUTTON(ComboPage_Add, ComboboxWidgetsPage::OnButtonAdd)
177 EVT_BUTTON(ComboPage_AddSeveral, ComboboxWidgetsPage::OnButtonAddSeveral)
178 EVT_BUTTON(ComboPage_AddMany, ComboboxWidgetsPage::OnButtonAddMany)
179 EVT_BUTTON(ComboPage_SetValue, ComboboxWidgetsPage::OnButtonSetValue)
180 EVT_BUTTON(ComboPage_SetCurrent, ComboboxWidgetsPage::OnButtonSetCurrent)
181 EVT_BUTTON(ComboPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
182
183 EVT_TEXT_ENTER(ComboPage_InsertText, ComboboxWidgetsPage::OnButtonInsert)
184 EVT_TEXT_ENTER(ComboPage_AddText, ComboboxWidgetsPage::OnButtonAdd)
185 EVT_TEXT_ENTER(ComboPage_DeleteText, ComboboxWidgetsPage::OnButtonDelete)
186
187 EVT_UPDATE_UI(ComboPage_InsertionPointText, ComboboxWidgetsPage::OnUpdateUIInsertionPointText)
188
189 EVT_UPDATE_UI(ComboPage_Reset, ComboboxWidgetsPage::OnUpdateUIResetButton)
190 EVT_UPDATE_UI(ComboPage_Insert, ComboboxWidgetsPage::OnUpdateUIInsert)
191 EVT_UPDATE_UI(ComboPage_AddSeveral, ComboboxWidgetsPage::OnUpdateUIAddSeveral)
192 EVT_UPDATE_UI(ComboPage_Clear, ComboboxWidgetsPage::OnUpdateUIClearButton)
193 EVT_UPDATE_UI(ComboPage_DeleteText, ComboboxWidgetsPage::OnUpdateUIClearButton)
194 EVT_UPDATE_UI(ComboPage_Delete, ComboboxWidgetsPage::OnUpdateUIDeleteButton)
195 EVT_UPDATE_UI(ComboPage_Change, ComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
196 EVT_UPDATE_UI(ComboPage_ChangeText, ComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
197 EVT_UPDATE_UI(ComboPage_DeleteSel, ComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
198 EVT_UPDATE_UI(ComboPage_SetCurrent, ComboboxWidgetsPage::OnUpdateUISetCurrent)
199
200 EVT_COMBOBOX(ComboPage_Combo, ComboboxWidgetsPage::OnComboBox)
201 EVT_TEXT(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
202 EVT_TEXT_ENTER(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
203
204 EVT_CHECKBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
205 EVT_RADIOBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
206 END_EVENT_TABLE()
207
208 // ============================================================================
209 // implementation
210 // ============================================================================
211
212 #if defined(__WXUNIVERSAL__)
213 #define FAMILY_CTRLS UNIVERSAL_CTRLS
214 #else
215 #define FAMILY_CTRLS NATIVE_CTRLS
216 #endif
217
218 IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"),
219 FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
220 );
221
222 ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
223 wxImageList *imaglist)
224 : ItemContainerWidgetsPage(book, imaglist, combobox_xpm)
225 {
226 // init everything
227 m_chkSort =
228 m_chkReadonly =
229 m_chkFilename = (wxCheckBox *)NULL;
230
231 m_combobox = (wxComboBox *)NULL;
232 m_sizerCombo = (wxSizer *)NULL;
233 }
234
235 void ComboboxWidgetsPage::CreateContent()
236 {
237 /*
238 What we create here is a frame having 3 panes: style pane is the
239 leftmost one, in the middle the pane with buttons allowing to perform
240 miscellaneous combobox operations and the pane containing the combobox
241 itself to the right
242 */
243 wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
244
245 // left pane
246 wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style"));
247
248 // should be in sync with ComboKind_XXX values
249 static const wxString kinds[] =
250 {
251 _T("default"),
252 _T("simple"),
253 _T("drop down"),
254 };
255
256 m_radioKind = new wxRadioBox(this, wxID_ANY, _T("Combobox &kind:"),
257 wxDefaultPosition, wxDefaultSize,
258 WXSIZEOF(kinds), kinds,
259 1, wxRA_SPECIFY_COLS);
260
261 wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
262
263 m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Sort items"));
264 m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Read only"));
265 m_chkFilename = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&File name"));
266 m_chkFilename->Disable(); // not implemented yet
267
268 sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
269 sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
270
271 wxButton *btn = new wxButton(this, ComboPage_Reset, _T("&Reset"));
272 sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
273
274 // middle pane
275 wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
276 _T("&Change combobox contents"));
277 wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
278
279 wxSizer *sizerRow;
280
281 sizerRow = CreateSizerWithTextAndButton(ComboPage_SetCurrent,
282 _T("Current &selection"),
283 ComboPage_CurText,
284 &m_textCur);
285
286 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
287
288 wxTextCtrl *text;
289 sizerRow = CreateSizerWithTextAndLabel(_T("Insertion Point"),
290 ComboPage_InsertionPointText,
291 &text);
292 text->SetEditable(false);
293
294 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
295
296 sizerRow = CreateSizerWithTextAndButton(ComboPage_Insert,
297 _T("&Insert this string"),
298 ComboPage_InsertText,
299 &m_textInsert);
300 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
301
302 sizerRow = CreateSizerWithTextAndButton(ComboPage_Add,
303 _T("&Add this string"),
304 ComboPage_AddText,
305 &m_textAdd);
306 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
307
308 btn = new wxButton(this, ComboPage_AddSeveral, _T("&Append a few strings"));
309 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
310
311 btn = new wxButton(this, ComboPage_AddMany, _T("Append &many strings"));
312 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
313
314 sizerRow = CreateSizerWithTextAndButton(ComboPage_Change,
315 _T("C&hange current"),
316 ComboPage_ChangeText,
317 &m_textChange);
318 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
319
320 sizerRow = CreateSizerWithTextAndButton(ComboPage_Delete,
321 _T("&Delete this item"),
322 ComboPage_DeleteText,
323 &m_textDelete);
324 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
325
326 btn = new wxButton(this, ComboPage_DeleteSel, _T("Delete &selection"));
327 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
328
329 btn = new wxButton(this, ComboPage_Clear, _T("&Clear"));
330 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
331
332 sizerRow = CreateSizerWithTextAndButton(ComboPage_SetValue,
333 _T("SetValue"),
334 ComboPage_SetValueText,
335 &m_textSetValue);
336 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
337
338 btn = new wxButton(this, ComboPage_ContainerTests, _T("Run &tests"));
339 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
340
341
342
343 // right pane
344 wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
345 m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
346 wxDefaultPosition, wxDefaultSize,
347 0, NULL,
348 0);
349 sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5);
350 sizerRight->SetMinSize(150, 0);
351 m_sizerCombo = sizerRight; // save it to modify it later
352
353 // the 3 panes panes compose the window
354 sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
355 sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
356 sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
357
358 // final initializations
359 Reset();
360
361 SetSizer(sizerTop);
362 }
363
364 // ----------------------------------------------------------------------------
365 // operations
366 // ----------------------------------------------------------------------------
367
368 void ComboboxWidgetsPage::Reset()
369 {
370 m_chkSort->SetValue(false);
371 m_chkReadonly->SetValue(false);
372 m_chkFilename->SetValue(false);
373 }
374
375 void ComboboxWidgetsPage::CreateCombo()
376 {
377 int flags = ms_defaultFlags;
378
379 if ( m_chkSort->GetValue() )
380 flags |= wxCB_SORT;
381 if ( m_chkReadonly->GetValue() )
382 flags |= wxCB_READONLY;
383
384 switch ( m_radioKind->GetSelection() )
385 {
386 default:
387 wxFAIL_MSG( _T("unknown combo kind") );
388 // fall through
389
390 case ComboKind_Default:
391 break;
392
393 case ComboKind_Simple:
394 flags |= wxCB_SIMPLE;
395 break;
396
397 case ComboKind_DropDown:
398 flags = wxCB_DROPDOWN;
399 break;
400 }
401
402 wxArrayString items;
403 if ( m_combobox )
404 {
405 unsigned int count = m_combobox->GetCount();
406 for ( unsigned int n = 0; n < count; n++ )
407 {
408 items.Add(m_combobox->GetString(n));
409 }
410
411 m_sizerCombo->Detach( m_combobox );
412 delete m_combobox;
413 }
414
415 m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
416 wxDefaultPosition, wxDefaultSize,
417 0, NULL,
418 flags);
419
420 #if 0
421 if ( m_chkFilename->GetValue() )
422 ;
423 #endif // TODO
424
425 unsigned int count = items.GetCount();
426 for ( unsigned int n = 0; n < count; n++ )
427 {
428 m_combobox->Append(items[n]);
429 }
430
431 m_sizerCombo->Add(m_combobox, 1, wxGROW | wxALL, 5);
432 m_sizerCombo->Layout();
433 }
434
435 // ----------------------------------------------------------------------------
436 // event handlers
437 // ----------------------------------------------------------------------------
438
439 void ComboboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
440 {
441 Reset();
442
443 CreateCombo();
444 }
445
446 void ComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
447 {
448 int sel = m_combobox->GetSelection();
449 if ( sel != wxNOT_FOUND )
450 {
451 #ifndef __WXGTK__
452 m_combobox->SetString(sel, m_textChange->GetValue());
453 #else
454 wxLogMessage(_T("Not implemented in wxGTK"));
455 #endif
456 }
457 }
458
459 void ComboboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
460 {
461 unsigned long n;
462 if ( !m_textDelete->GetValue().ToULong(&n) ||
463 (n >= m_combobox->GetCount()) )
464 {
465 return;
466 }
467
468 m_combobox->Delete(n);
469 }
470
471 void ComboboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
472 {
473 int sel = m_combobox->GetSelection();
474 if ( sel != wxNOT_FOUND )
475 {
476 m_combobox->Delete(sel);
477 }
478 }
479
480 void ComboboxWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
481 {
482 wxString value = m_textSetValue->GetValue();
483 m_combobox->SetValue( value );
484 }
485
486 void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
487 {
488 m_combobox->Clear();
489 }
490
491 void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
492 {
493 static unsigned int s_item = 0;
494
495 wxString s = m_textInsert->GetValue();
496 if ( !m_textInsert->IsModified() )
497 {
498 // update the default string
499 m_textInsert->SetValue(wxString::Format(_T("test item %u"), ++s_item));
500 }
501
502 if (m_combobox->GetSelection() >= 0)
503 m_combobox->Insert(s, m_combobox->GetSelection());
504 }
505
506 void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
507 {
508 static unsigned int s_item = 0;
509
510 wxString s = m_textAdd->GetValue();
511 if ( !m_textAdd->IsModified() )
512 {
513 // update the default string
514 m_textAdd->SetValue(wxString::Format(_T("test item %u"), ++s_item));
515 }
516
517 m_combobox->Append(s);
518 }
519
520 void ComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
521 {
522 // "many" means 1000 here
523 for ( unsigned int n = 0; n < 1000; n++ )
524 {
525 m_combobox->Append(wxString::Format(_T("item #%u"), n));
526 }
527 }
528
529 void ComboboxWidgetsPage::OnButtonSetCurrent(wxCommandEvent& WXUNUSED(event))
530 {
531 long n;
532 if ( !m_textCur->GetValue().ToLong(&n) )
533 return;
534
535 m_combobox->SetSelection(n);
536 }
537
538 void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
539 {
540 m_combobox->Append(_T("First"));
541 m_combobox->Append(_T("another one"));
542 m_combobox->Append(_T("and the last (very very very very very very very very very very long) one"));
543 }
544
545 void ComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event)
546 {
547 if (m_combobox)
548 event.SetText( wxString::Format(_T("%ld"), m_combobox->GetInsertionPoint()) );
549 }
550
551 void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
552 {
553 event.Enable( m_chkSort->GetValue() ||
554 m_chkReadonly->GetValue() ||
555 m_chkFilename->GetValue() );
556 }
557
558 void ComboboxWidgetsPage::OnUpdateUIInsert(wxUpdateUIEvent& event)
559 {
560 if (m_combobox)
561 {
562 bool enable = !(m_combobox->GetWindowStyle() & wxCB_SORT) &&
563 (m_combobox->GetSelection() >= 0);
564
565 event.Enable(enable);
566 }
567 }
568
569 void ComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
570 {
571 if (m_combobox)
572 {
573 unsigned long n;
574 event.Enable(m_textDelete->GetValue().ToULong(&n) &&
575 (n < (unsigned)m_combobox->GetCount()));
576 }
577 }
578
579 void ComboboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
580 {
581 if (m_combobox)
582 event.Enable(m_combobox->GetSelection() != wxNOT_FOUND);
583 }
584
585 void ComboboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
586 {
587 if (m_combobox)
588 event.Enable(m_combobox->GetCount() != 0);
589 }
590
591 void ComboboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
592 {
593 if (m_combobox)
594 event.Enable(!(m_combobox->GetWindowStyle() & wxCB_SORT));
595 }
596
597 void ComboboxWidgetsPage::OnUpdateUISetCurrent(wxUpdateUIEvent& event)
598 {
599 long n;
600 event.Enable( m_textCur->GetValue().ToLong(&n) &&
601 (n == wxNOT_FOUND ||
602 (n >= 0 && (unsigned)n < m_combobox->GetCount())) );
603 }
604
605 void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
606 {
607 if (!m_combobox)
608 return;
609
610 wxString s = event.GetString();
611
612 wxASSERT_MSG( s == m_combobox->GetValue(),
613 _T("event and combobox values should be the same") );
614
615 if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
616 wxLogMessage(_T("Combobox enter pressed (now '%s')"), s.c_str());
617 else
618 wxLogMessage(_T("Combobox text changed (now '%s')"), s.c_str());
619 }
620
621 void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
622 {
623 long sel = event.GetInt();
624 const wxString selstr = wxString::Format(_T("%ld"), sel);
625 m_textDelete->SetValue(selstr);
626 m_textCur->SetValue(selstr);
627
628 wxLogMessage(_T("Combobox item %ld selected"), sel);
629
630 wxLogMessage(_T("Combobox GetValue(): %s"), m_combobox->GetValue().c_str() );
631 }
632
633 void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
634 {
635 CreateCombo();
636 }
637
638 #endif //wxUSE_COMBOBOX
639
640 #endif