]> git.saurik.com Git - wxWidgets.git/blob - samples/widgets/listbox.cpp
Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / samples / widgets / listbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Program: wxWidgets Widgets Sample
3 // Name: listbox.cpp
4 // Purpose: Part of the widgets sample showing wxListbox
5 // Author: Vadim Zeitlin
6 // Created: 27.03.01
7 // Copyright: (c) 2001 Vadim Zeitlin
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // for compilers that support precompilation, includes "wx/wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_LISTBOX
27
28 // for all others, include the necessary headers
29 #ifndef WX_PRECOMP
30 #include "wx/log.h"
31
32 #include "wx/bitmap.h"
33 #include "wx/button.h"
34 #include "wx/checkbox.h"
35 #include "wx/combobox.h"
36 #include "wx/listbox.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 "wx/checklst.h"
45
46 #include "itemcontainer.h"
47 #include "widgets.h"
48
49 #include "icons/listbox.xpm"
50
51 // ----------------------------------------------------------------------------
52 // constants
53 // ----------------------------------------------------------------------------
54
55 // control ids
56 enum
57 {
58 ListboxPage_Reset = wxID_HIGHEST,
59 ListboxPage_Add,
60 ListboxPage_AddText,
61 ListboxPage_AddSeveral,
62 ListboxPage_AddMany,
63 ListboxPage_Clear,
64 ListboxPage_Change,
65 ListboxPage_ChangeText,
66 ListboxPage_Delete,
67 ListboxPage_DeleteText,
68 ListboxPage_DeleteSel,
69 ListboxPage_Listbox,
70 ListboxPage_EnsureVisible,
71 ListboxPage_EnsureVisibleText,
72 ListboxPage_ContainerTests
73 };
74
75 // ----------------------------------------------------------------------------
76 // ListboxWidgetsPage
77 // ----------------------------------------------------------------------------
78
79 class ListboxWidgetsPage : public ItemContainerWidgetsPage
80 {
81 public:
82 ListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
83
84 virtual wxControl *GetWidget() const { return m_lbox; }
85 virtual wxItemContainer* GetContainer() const { return m_lbox; }
86 virtual void RecreateWidget() { CreateLbox(); }
87
88 // lazy creation of the content
89 virtual void CreateContent();
90
91 protected:
92 // event handlers
93 void OnButtonReset(wxCommandEvent& event);
94 void OnButtonChange(wxCommandEvent& event);
95 void OnButtonEnsureVisible(wxCommandEvent& event);
96 void OnButtonDelete(wxCommandEvent& event);
97 void OnButtonDeleteSel(wxCommandEvent& event);
98 void OnButtonClear(wxCommandEvent& event);
99 void OnButtonAdd(wxCommandEvent& event);
100 void OnButtonAddSeveral(wxCommandEvent& event);
101 void OnButtonAddMany(wxCommandEvent& event);
102
103 void OnListbox(wxCommandEvent& event);
104 void OnListboxDClick(wxCommandEvent& event);
105 void OnCheckListbox(wxCommandEvent& event);
106
107 void OnCheckOrRadioBox(wxCommandEvent& event);
108
109 void OnUpdateUIAddSeveral(wxUpdateUIEvent& event);
110 void OnUpdateUIClearButton(wxUpdateUIEvent& event);
111 void OnUpdateUIEnsureVisibleButton(wxUpdateUIEvent& event);
112 void OnUpdateUIDeleteButton(wxUpdateUIEvent& event);
113 void OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event);
114 void OnUpdateUIResetButton(wxUpdateUIEvent& event);
115
116 // reset the listbox parameters
117 void Reset();
118
119 // (re)create the listbox
120 void CreateLbox();
121
122 // read the value of a listbox item index from the given control, return
123 // false if it's invalid
124 bool GetValidIndexFromText(const wxTextCtrl *text, int *n = NULL) const;
125
126
127 // listbox parameters
128 // ------------------
129
130 // the selection mode
131 enum LboxSelection
132 {
133 LboxSel_Single,
134 LboxSel_Extended,
135 LboxSel_Multiple
136 } m_lboxSelMode;
137
138 // should it be sorted?
139 bool m_sorted;
140
141 // should it have horz scroll/vert scrollbar permanently shown?
142 bool m_horzScroll,
143 m_vertScrollAlways;
144
145 // the controls
146 // ------------
147
148 // the sel mode radiobox
149 wxRadioBox *m_radioSelMode;
150
151 // the checkboxes
152 wxCheckBox *m_chkVScroll,
153 *m_chkHScroll,
154 *m_chkCheck,
155 *m_chkSort,
156 *m_chkOwnerDraw;
157
158 // the listbox itself and the sizer it is in
159 #ifdef __WXWINCE__
160 wxListBoxBase
161 #else
162 wxListBox
163 #endif
164 *m_lbox;
165
166 wxSizer *m_sizerLbox;
167
168 // the text entries for "Add/change string" and "Delete" buttons
169 wxTextCtrl *m_textAdd,
170 *m_textChange,
171 *m_textEnsureVisible,
172 *m_textDelete;
173
174 private:
175 DECLARE_EVENT_TABLE()
176 DECLARE_WIDGETS_PAGE(ListboxWidgetsPage)
177 };
178
179 // ----------------------------------------------------------------------------
180 // event tables
181 // ----------------------------------------------------------------------------
182
183 BEGIN_EVENT_TABLE(ListboxWidgetsPage, WidgetsPage)
184 EVT_BUTTON(ListboxPage_Reset, ListboxWidgetsPage::OnButtonReset)
185 EVT_BUTTON(ListboxPage_Change, ListboxWidgetsPage::OnButtonChange)
186 EVT_BUTTON(ListboxPage_Delete, ListboxWidgetsPage::OnButtonDelete)
187 EVT_BUTTON(ListboxPage_DeleteSel, ListboxWidgetsPage::OnButtonDeleteSel)
188 EVT_BUTTON(ListboxPage_EnsureVisible, ListboxWidgetsPage::OnButtonEnsureVisible)
189 EVT_BUTTON(ListboxPage_Clear, ListboxWidgetsPage::OnButtonClear)
190 EVT_BUTTON(ListboxPage_Add, ListboxWidgetsPage::OnButtonAdd)
191 EVT_BUTTON(ListboxPage_AddSeveral, ListboxWidgetsPage::OnButtonAddSeveral)
192 EVT_BUTTON(ListboxPage_AddMany, ListboxWidgetsPage::OnButtonAddMany)
193 EVT_BUTTON(ListboxPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
194
195 EVT_TEXT_ENTER(ListboxPage_AddText, ListboxWidgetsPage::OnButtonAdd)
196 EVT_TEXT_ENTER(ListboxPage_DeleteText, ListboxWidgetsPage::OnButtonDelete)
197 EVT_TEXT_ENTER(ListboxPage_EnsureVisibleText, ListboxWidgetsPage::OnButtonEnsureVisible)
198
199 EVT_UPDATE_UI(ListboxPage_Reset, ListboxWidgetsPage::OnUpdateUIResetButton)
200 EVT_UPDATE_UI(ListboxPage_AddSeveral, ListboxWidgetsPage::OnUpdateUIAddSeveral)
201 EVT_UPDATE_UI(ListboxPage_Clear, ListboxWidgetsPage::OnUpdateUIClearButton)
202 EVT_UPDATE_UI(ListboxPage_DeleteText, ListboxWidgetsPage::OnUpdateUIClearButton)
203 EVT_UPDATE_UI(ListboxPage_Delete, ListboxWidgetsPage::OnUpdateUIDeleteButton)
204 EVT_UPDATE_UI(ListboxPage_Change, ListboxWidgetsPage::OnUpdateUIDeleteSelButton)
205 EVT_UPDATE_UI(ListboxPage_ChangeText, ListboxWidgetsPage::OnUpdateUIDeleteSelButton)
206 EVT_UPDATE_UI(ListboxPage_DeleteSel, ListboxWidgetsPage::OnUpdateUIDeleteSelButton)
207 EVT_UPDATE_UI(ListboxPage_EnsureVisible, ListboxWidgetsPage::OnUpdateUIEnsureVisibleButton)
208
209 EVT_LISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnListbox)
210 EVT_LISTBOX_DCLICK(ListboxPage_Listbox, ListboxWidgetsPage::OnListboxDClick)
211 EVT_CHECKLISTBOX(ListboxPage_Listbox, ListboxWidgetsPage::OnCheckListbox)
212
213 EVT_CHECKBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox)
214 EVT_RADIOBOX(wxID_ANY, ListboxWidgetsPage::OnCheckOrRadioBox)
215 END_EVENT_TABLE()
216
217 // ============================================================================
218 // implementation
219 // ============================================================================
220
221 #if defined(__WXUNIVERSAL__)
222 #define FAMILY_CTRLS UNIVERSAL_CTRLS
223 #else
224 #define FAMILY_CTRLS NATIVE_CTRLS
225 #endif
226
227 IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, wxT("Listbox"),
228 FAMILY_CTRLS | WITH_ITEMS_CTRLS
229 );
230
231 ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,
232 wxImageList *imaglist)
233 : ItemContainerWidgetsPage(book, imaglist, listbox_xpm)
234 {
235 // init everything
236 m_radioSelMode = (wxRadioBox *)NULL;
237
238 m_chkVScroll =
239 m_chkHScroll =
240 m_chkCheck =
241 m_chkSort =
242 m_chkOwnerDraw = (wxCheckBox *)NULL;
243
244 m_lbox = NULL;
245 m_sizerLbox = (wxSizer *)NULL;
246
247 }
248
249 void ListboxWidgetsPage::CreateContent()
250 {
251 /*
252 What we create here is a frame having 3 panes: style pane is the
253 leftmost one, in the middle the pane with buttons allowing to perform
254 miscellaneous listbox operations and the pane containing the listbox
255 itself to the right
256 */
257 wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
258
259 // left pane
260 wxStaticBox *box = new wxStaticBox(this, wxID_ANY,
261 wxT("&Set listbox parameters"));
262 wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
263
264 static const wxString modes[] =
265 {
266 wxT("single"),
267 wxT("extended"),
268 wxT("multiple"),
269 };
270
271 m_radioSelMode = new wxRadioBox(this, wxID_ANY, wxT("Selection &mode:"),
272 wxDefaultPosition, wxDefaultSize,
273 WXSIZEOF(modes), modes,
274 1, wxRA_SPECIFY_COLS);
275
276 m_chkVScroll = CreateCheckBoxAndAddToSizer
277 (
278 sizerLeft,
279 wxT("Always show &vertical scrollbar")
280 );
281 m_chkHScroll = CreateCheckBoxAndAddToSizer
282 (
283 sizerLeft,
284 wxT("Show &horizontal scrollbar")
285 );
286 m_chkCheck = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Check list box"));
287 m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Sort items"));
288 m_chkOwnerDraw = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Owner drawn"));
289
290 sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
291 sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5);
292
293 wxButton *btn = new wxButton(this, ListboxPage_Reset, wxT("&Reset"));
294 sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
295
296 // middle pane
297 wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
298 wxT("&Change listbox contents"));
299 wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
300
301 wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
302 btn = new wxButton(this, ListboxPage_Add, wxT("&Add this string"));
303 m_textAdd = new wxTextCtrl(this, ListboxPage_AddText, wxT("test item 0"));
304 sizerRow->Add(btn, 0, wxRIGHT, 5);
305 sizerRow->Add(m_textAdd, 1, wxLEFT, 5);
306 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
307
308 btn = new wxButton(this, ListboxPage_AddSeveral, wxT("&Insert a few strings"));
309 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
310
311 btn = new wxButton(this, ListboxPage_AddMany, wxT("Add &many strings"));
312 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
313
314 sizerRow = new wxBoxSizer(wxHORIZONTAL);
315 btn = new wxButton(this, ListboxPage_Change, wxT("C&hange current"));
316 m_textChange = new wxTextCtrl(this, ListboxPage_ChangeText, wxEmptyString);
317 sizerRow->Add(btn, 0, wxRIGHT, 5);
318 sizerRow->Add(m_textChange, 1, wxLEFT, 5);
319 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
320
321 sizerRow = new wxBoxSizer(wxHORIZONTAL);
322 btn = new wxButton(this, ListboxPage_EnsureVisible, wxT("Make item &visible"));
323 m_textEnsureVisible = new wxTextCtrl(this, ListboxPage_EnsureVisibleText, wxEmptyString);
324 sizerRow->Add(btn, 0, wxRIGHT, 5);
325 sizerRow->Add(m_textEnsureVisible, 1, wxLEFT, 5);
326 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
327
328 sizerRow = new wxBoxSizer(wxHORIZONTAL);
329 btn = new wxButton(this, ListboxPage_Delete, wxT("&Delete this item"));
330 m_textDelete = new wxTextCtrl(this, ListboxPage_DeleteText, wxEmptyString);
331 sizerRow->Add(btn, 0, wxRIGHT, 5);
332 sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
333 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
334
335 btn = new wxButton(this, ListboxPage_DeleteSel, wxT("Delete &selection"));
336 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
337
338 btn = new wxButton(this, ListboxPage_Clear, wxT("&Clear"));
339 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
340
341 btn = new wxButton(this, ListboxPage_ContainerTests, wxT("Run &tests"));
342 sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
343
344 // right pane
345 wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
346 m_lbox = new wxListBox(this, ListboxPage_Listbox,
347 wxDefaultPosition, wxDefaultSize,
348 0, NULL,
349 wxLB_HSCROLL);
350 sizerRight->Add(m_lbox, 1, wxGROW | wxALL, 5);
351 sizerRight->SetMinSize(150, 0);
352 m_sizerLbox = sizerRight; // save it to modify it later
353
354 // the 3 panes panes compose the window
355 sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
356 sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10);
357 sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
358
359 // final initializations
360 Reset();
361
362 SetSizer(sizerTop);
363 }
364
365 // ----------------------------------------------------------------------------
366 // operations
367 // ----------------------------------------------------------------------------
368
369 void ListboxWidgetsPage::Reset()
370 {
371 m_radioSelMode->SetSelection(LboxSel_Single);
372 m_chkVScroll->SetValue(false);
373 m_chkHScroll->SetValue(true);
374 m_chkCheck->SetValue(false);
375 m_chkSort->SetValue(false);
376 m_chkOwnerDraw->SetValue(false);
377 }
378
379 void ListboxWidgetsPage::CreateLbox()
380 {
381 int flags = ms_defaultFlags;
382 switch ( m_radioSelMode->GetSelection() )
383 {
384 default:
385 wxFAIL_MSG( wxT("unexpected radio box selection") );
386
387 case LboxSel_Single: flags |= wxLB_SINGLE; break;
388 case LboxSel_Extended: flags |= wxLB_EXTENDED; break;
389 case LboxSel_Multiple: flags |= wxLB_MULTIPLE; break;
390 }
391
392 if ( m_chkVScroll->GetValue() )
393 flags |= wxLB_ALWAYS_SB;
394 if ( m_chkHScroll->GetValue() )
395 flags |= wxLB_HSCROLL;
396 if ( m_chkSort->GetValue() )
397 flags |= wxLB_SORT;
398 if ( m_chkOwnerDraw->GetValue() )
399 flags |= wxLB_OWNERDRAW;
400
401 wxArrayString items;
402 if ( m_lbox )
403 {
404 int count = m_lbox->GetCount();
405 for ( int n = 0; n < count; n++ )
406 {
407 items.Add(m_lbox->GetString(n));
408 }
409
410 m_sizerLbox->Detach( m_lbox );
411 delete m_lbox;
412 }
413
414 #if wxUSE_CHECKLISTBOX
415 if ( m_chkCheck->GetValue() )
416 {
417 m_lbox = new wxCheckListBox(this, ListboxPage_Listbox,
418 wxDefaultPosition, wxDefaultSize,
419 0, NULL,
420 flags);
421 }
422 else // just a listbox
423 #endif
424 {
425 m_lbox = new wxListBox(this, ListboxPage_Listbox,
426 wxDefaultPosition, wxDefaultSize,
427 0, NULL,
428 flags);
429 }
430
431 m_lbox->Set(items);
432 m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
433 m_sizerLbox->Layout();
434 }
435
436 // ----------------------------------------------------------------------------
437 // miscellaneous helpers
438 // ----------------------------------------------------------------------------
439
440 bool
441 ListboxWidgetsPage::GetValidIndexFromText(const wxTextCtrl *text, int *n) const
442 {
443 unsigned long idx;
444 if ( !text->GetValue().ToULong(&idx) || (idx >= m_lbox->GetCount()) )
445 {
446 // don't give the warning if we're just testing but do give it if we
447 // want to retrieve the value as this is only done in answer to a user
448 // action
449 if ( n )
450 {
451 wxLogWarning("Invalid index \"%s\"", text->GetValue());
452 }
453
454 return false;
455 }
456
457 if ( n )
458 *n = idx;
459
460 return true;
461 }
462
463 // ----------------------------------------------------------------------------
464 // event handlers
465 // ----------------------------------------------------------------------------
466
467 void ListboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
468 {
469 Reset();
470
471 CreateLbox();
472 }
473
474 void ListboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
475 {
476 wxArrayInt selections;
477 int count = m_lbox->GetSelections(selections);
478 wxString s = m_textChange->GetValue();
479 for ( int n = 0; n < count; n++ )
480 {
481 m_lbox->SetString(selections[n], s);
482 }
483 }
484
485 void ListboxWidgetsPage::OnButtonEnsureVisible(wxCommandEvent& WXUNUSED(event))
486 {
487 int n;
488 if ( !GetValidIndexFromText(m_textEnsureVisible, &n) )
489 {
490 return;
491 }
492
493 m_lbox->EnsureVisible(n);
494 }
495
496 void ListboxWidgetsPage::OnButtonDelete(wxCommandEvent& WXUNUSED(event))
497 {
498 int n;
499 if ( !GetValidIndexFromText(m_textDelete, &n) )
500 {
501 return;
502 }
503
504 m_lbox->Delete(n);
505 }
506
507 void ListboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
508 {
509 wxArrayInt selections;
510 int n = m_lbox->GetSelections(selections);
511 while ( n > 0 )
512 {
513 m_lbox->Delete(selections[--n]);
514 }
515 }
516
517 void ListboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
518 {
519 m_lbox->Clear();
520 }
521
522 void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
523 {
524 static unsigned int s_item = 0;
525
526 wxString s = m_textAdd->GetValue();
527 if ( !m_textAdd->IsModified() )
528 {
529 // update the default string
530 m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item));
531 }
532
533 m_lbox->Append(s);
534 }
535
536 void ListboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
537 {
538 // "many" means 1000 here
539 for ( unsigned int n = 0; n < 1000; n++ )
540 {
541 m_lbox->Append(wxString::Format(wxT("item #%u"), n));
542 }
543 }
544
545 void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
546 {
547 wxArrayString items;
548 items.Add(wxT("First"));
549 items.Add(wxT("another one"));
550 items.Add(wxT("and the last (very very very very very very very very very very long) one"));
551 m_lbox->InsertItems(items, 0);
552 }
553
554 void ListboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
555 {
556 event.Enable( (m_radioSelMode->GetSelection() != LboxSel_Single) ||
557 m_chkSort->GetValue() ||
558 m_chkOwnerDraw->GetValue() ||
559 !m_chkHScroll->GetValue() ||
560 m_chkVScroll->GetValue() );
561 }
562
563 void ListboxWidgetsPage::OnUpdateUIEnsureVisibleButton(wxUpdateUIEvent& event)
564 {
565 event.Enable(GetValidIndexFromText(m_textEnsureVisible));
566 }
567
568 void ListboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
569 {
570 event.Enable(GetValidIndexFromText(m_textDelete));
571 }
572
573 void ListboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
574 {
575 wxArrayInt selections;
576 event.Enable(m_lbox->GetSelections(selections) != 0);
577 }
578
579 void ListboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
580 {
581 event.Enable(m_lbox->GetCount() != 0);
582 }
583
584 void ListboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
585 {
586 event.Enable(!(m_lbox->GetWindowStyle() & wxLB_SORT));
587 }
588
589 void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
590 {
591 long sel = event.GetSelection();
592 m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel));
593
594 if (event.IsSelection())
595 {
596 wxLogMessage(wxT("Listbox item %ld selected"), sel);
597 }
598 else
599 {
600 wxLogMessage(wxT("Listbox item %ld deselected"), sel);
601 }
602 }
603
604 void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event)
605 {
606 wxLogMessage( wxT("Listbox item %d double clicked"), event.GetInt() );
607 }
608
609 void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event)
610 {
611 wxLogMessage( wxT("Listbox item %d toggled"), event.GetInt() );
612 }
613
614 void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
615 {
616 CreateLbox();
617 }
618
619 #endif // wxUSE_LISTBOX