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