Don't try to determine the clicked item ourselves in wxMSW wxListBox.
This doesn't work when the listbox is scrolled as the result of a click to make the selected item fully visible and results in the index of the item being off by 1 in the generated event which is a pretty serious problem. Fix it by simply retrieving the item from the listbox itself, without doing any hit testing. This seems to give the correct result in all cases and also makes the code much simpler as we don't have to use 2 different ways of finding the item depending on whether it was selected using the keyboard or the mouse and makes it unnecessary to keep track of how the selection was done completely, i.e. reverts r64498 which is not needed any more. Closes #14635. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -151,8 +151,6 @@ public:
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
@@ -194,10 +192,6 @@ private:
|
||||
// i.e. if we need to call SetHorizontalExtent() from OnInternalIdle()
|
||||
bool m_updateHorizontalExtent;
|
||||
|
||||
// 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;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox)
|
||||
};
|
||||
|
Reference in New Issue
Block a user