/////////////////////////////////////////////////////////////////////////////
-// Program: wxWindows Widgets Sample
+// Program: wxWidgets Widgets Sample
// Name: listbox.cpp
// Purpose: Part of the widgets sample showing wxListbox
// Author: Vadim Zeitlin
#pragma hdrstop
#endif
+#if wxUSE_LISTBOX
+
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/checklst.h"
#include "widgets.h"
-#if 1
+
#include "icons/listbox.xpm"
// ----------------------------------------------------------------------------
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)
CreateLbox();
}
-#endif
+#endif // wxUSE_LISTBOX