X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/206d3a16caa7a4e626395ae52cc8f7e0225e202d..1e72e3cc53f04cc79189ab5d0f6fecca3f68a2ee:/samples/widgets/listbox.cpp diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index fa37386532..65ae57555e 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Program: wxWindows Widgets Sample +// Program: wxWidgets Widgets Sample // Name: listbox.cpp // Purpose: Part of the widgets sample showing wxListbox // Author: Vadim Zeitlin @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_LISTBOX + // for all others, include the necessary headers #ifndef WX_PRECOMP #include "wx/log.h" @@ -43,7 +45,7 @@ #include "wx/checklst.h" #include "widgets.h" -#if 1 + #include "icons/listbox.xpm" // ---------------------------------------------------------------------------- @@ -493,10 +495,13 @@ void ListboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event) void ListboxWidgetsPage::OnListbox(wxCommandEvent& event) { - long sel = event.GetInt(); + long sel = event.GetSelection(); m_textDelete->SetValue(wxString::Format(_T("%ld"), sel)); - wxLogMessage(_T("Listbox item %ld selected"), sel); + if (event.IsSelection()) + wxLogMessage(_T("Listbox item %ld selected"), sel); + else + wxLogMessage(_T("Listbox item %ld deselected"), sel); } void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event) @@ -514,4 +519,4 @@ void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) CreateLbox(); } -#endif +#endif // wxUSE_LISTBOX