FIX: handle mouseCaptureLost in common ctrls

Change-Id: Ifde2406911a628fa61acf41c0e7a5120612d73bf
This commit is contained in:
chunmao.guo 2022-10-08 11:39:23 +08:00 committed by Lane.Wei
parent e2d10baea0
commit 3d7d2badf7
6 changed files with 42 additions and 3 deletions

View file

@ -9,6 +9,7 @@ BEGIN_EVENT_TABLE(DropDown, wxPopupTransientWindow)
EVT_LEFT_DOWN(DropDown::mouseDown)
EVT_LEFT_UP(DropDown::mouseReleased)
EVT_MOUSE_CAPTURE_LOST(DropDown::mouseCaptureLost)
EVT_MOTION(DropDown::mouseMove)
EVT_MOUSEWHEEL(DropDown::mouseWheelMoved)
@ -377,6 +378,7 @@ void DropDown::mouseDown(wxMouseEvent& event)
// force calc hover item again
mouseMove(event);
pressedDown = true;
CaptureMouse();
dragStart = event.GetPosition();
}
@ -385,6 +387,8 @@ void DropDown::mouseReleased(wxMouseEvent& event)
if (pressedDown) {
dragStart = wxPoint();
pressedDown = false;
if (HasCapture())
ReleaseMouse();
if (hover_item >= 0) { // not moved
sendDropDownEvent();
DismissAndNotify();
@ -392,6 +396,12 @@ void DropDown::mouseReleased(wxMouseEvent& event)
}
}
void DropDown::mouseCaptureLost(wxMouseCaptureLostEvent &event)
{
wxMouseEvent evt;
mouseReleased(evt);
}
void DropDown::mouseMove(wxMouseEvent &event)
{
wxPoint pt = event.GetPosition();