diff --git a/include/wx/htmllbox.h b/include/wx/htmllbox.h
index 3ef995e74e..22f453c83c 100644
--- a/include/wx/htmllbox.h
+++ b/include/wx/htmllbox.h
@@ -302,6 +302,14 @@ protected:
virtual wxString OnGetItem(size_t n) const
{ return m_items[n]; }
+ virtual void InitEvent(wxCommandEvent& event, int n)
+ {
+ // we're not a virtual control and we can include the string
+ // of the item which was clicked:
+ event.SetString(m_items[n]);
+ wxVListBox::InitEvent(event, n);
+ }
+
wxArrayString m_items;
wxArrayPtrVoid m_HTMLclientData;
diff --git a/include/wx/vlbox.h b/include/wx/vlbox.h
index 50d7472888..6ba94b4273 100644
--- a/include/wx/vlbox.h
+++ b/include/wx/vlbox.h
@@ -249,6 +249,7 @@ protected:
// send the wxEVT_COMMAND_LISTBOX_SELECTED event
void SendSelectedEvent();
+ virtual void InitEvent(wxCommandEvent& event, int n);
// common implementation of SelectAll() and DeselectAll()
bool DoSelectAll(bool select);
diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp
index 0d7f8ef199..13ce1b6278 100644
--- a/src/generic/vlbox.cpp
+++ b/src/generic/vlbox.cpp
@@ -261,15 +261,19 @@ bool wxVListBox::DoSetCurrent(int current)
return true;
}
+void wxVListBox::InitEvent(wxCommandEvent& event, int n)
+{
+ event.SetEventObject(this);
+ event.SetInt(n);
+}
+
void wxVListBox::SendSelectedEvent()
{
wxASSERT_MSG( m_current != wxNOT_FOUND,
_T("SendSelectedEvent() shouldn't be called") );
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId());
- event.SetEventObject(this);
- event.SetInt(m_current);
-
+ InitEvent(event, m_current);
(void)GetEventHandler()->ProcessEvent(event);
}
@@ -708,9 +712,7 @@ void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse)
if ( item == m_current )
{
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId());
- event.SetEventObject(this);
- event.SetInt(item);
-
+ InitEvent(event, item);
(void)GetEventHandler()->ProcessEvent(event);
}
else