In wxComboPopupEvtHandler::OnMouseEvent(), when need to relay event to drop-down button, call HandleButtonMouseEvent() directly, if possible. This is less confusing for the platform-specific wxComboCtrl implementations, and fixes issue where the drop-down button could remain in pressed state after the mouse button was lifted.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -142,6 +142,7 @@ struct wxComboCtrlFeatures
|
|||||||
class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl
|
class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl
|
||||||
{
|
{
|
||||||
friend class wxComboPopup;
|
friend class wxComboPopup;
|
||||||
|
friend class wxComboPopupEvtHandler;
|
||||||
public:
|
public:
|
||||||
// ctors and such
|
// ctors and such
|
||||||
wxComboCtrlBase() : wxControl() { Init(); }
|
wxComboCtrlBase() : wxControl() { Init(); }
|
||||||
|
@@ -760,6 +760,12 @@ void wxComboPopupEvtHandler::OnMouseEvent( wxMouseEvent& event )
|
|||||||
// block this one)
|
// block this one)
|
||||||
m_blockEventsToPopup = false;
|
m_blockEventsToPopup = false;
|
||||||
event.Skip(false);
|
event.Skip(false);
|
||||||
|
|
||||||
|
// Also, this button press was (probably) used to display
|
||||||
|
// the popup, so relay it back to the drop-down button
|
||||||
|
// (which supposedly originated it). This is necessary to
|
||||||
|
// refresh it properly.
|
||||||
|
relayToButton = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( m_blockEventsToPopup )
|
else if ( m_blockEventsToPopup )
|
||||||
@@ -789,12 +795,14 @@ void wxComboPopupEvtHandler::OnMouseEvent( wxMouseEvent& event )
|
|||||||
|
|
||||||
if ( relayToButton )
|
if ( relayToButton )
|
||||||
{
|
{
|
||||||
wxWindow* eventSink = m_combo;
|
|
||||||
wxWindow* btn = m_combo->GetButton();
|
wxWindow* btn = m_combo->GetButton();
|
||||||
if ( btn )
|
if ( btn )
|
||||||
eventSink = btn;
|
btn->GetEventHandler()->ProcessEvent(event);
|
||||||
|
else
|
||||||
eventSink->GetEventHandler()->ProcessEvent(event);
|
// Bypass the event handling mechanism. Using it would be
|
||||||
|
// confusing for the platform-specific wxComboCtrl
|
||||||
|
// implementations.
|
||||||
|
m_combo->HandleButtonMouseEvent(event, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user