Backport for for #12143: Click anywhere inside wxListBox generates wxEVT_COMMAND_LISTBOX_SELECTED event

Needs wxUSE_LISTBOX_SELECTION_FIX to be set to 1 in include/wx/msw/listbox.h since it is not binary compatible.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2011-02-17 11:01:22 +00:00
parent 0dc14e5fc5
commit 689839ed87
2 changed files with 75 additions and 1 deletions

View File

@@ -14,6 +14,10 @@
#if wxUSE_LISTBOX
// Fixing spurious selection events breaks binary compatibility, so this is normally 0.
// See ticket #12143
#define wxUSE_LISTBOX_SELECTION_FIX 0
// ----------------------------------------------------------------------------
// simple types
// ----------------------------------------------------------------------------
@@ -133,6 +137,10 @@ public:
return GetCompositeControlsDefaultAttributes(variant);
}
#if wxUSE_LISTBOX_SELECTION_FIX
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
#endif
protected:
virtual void DoSetSelection(int n, bool select);
virtual int DoAppend(const wxString& item);
@@ -158,6 +166,13 @@ protected:
wxListBoxItemsArray m_aItems;
#endif
#if wxUSE_LISTBOX_SELECTION_FIX
// flag set to true when we get a keyboard event and reset to false when we
// get a mouse one: this is used to find the correct item for the selection
// event
bool m_selectedByKeyboard;
#endif
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox)
};