FIX: test HasCapture before CaptureMouse
Change-Id: Ia18b2288b4601c1ae8769d56e5bf46b886a1264e
This commit is contained in:
parent
0da5585582
commit
8d0f19fd6a
|
@ -237,6 +237,7 @@ void Button::mouseDown(wxMouseEvent& event)
|
||||||
pressedDown = true;
|
pressedDown = true;
|
||||||
if (canFocus)
|
if (canFocus)
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
if (!HasCapture())
|
||||||
CaptureMouse();
|
CaptureMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ Button *SpinInput::createButton(bool inc)
|
||||||
delta = inc ? 1 : -1;
|
delta = inc ? 1 : -1;
|
||||||
SetValue(val + delta);
|
SetValue(val + delta);
|
||||||
text_ctrl->SetFocus();
|
text_ctrl->SetFocus();
|
||||||
|
if (!btn->HasCapture())
|
||||||
btn->CaptureMouse();
|
btn->CaptureMouse();
|
||||||
delta *= 8;
|
delta *= 8;
|
||||||
timer.Start(100);
|
timer.Start(100);
|
||||||
|
@ -237,11 +238,13 @@ Button *SpinInput::createButton(bool inc)
|
||||||
});
|
});
|
||||||
btn->Bind(wxEVT_LEFT_DCLICK, [=](auto &e) {
|
btn->Bind(wxEVT_LEFT_DCLICK, [=](auto &e) {
|
||||||
delta = inc ? 1 : -1;
|
delta = inc ? 1 : -1;
|
||||||
|
if (!btn->HasCapture())
|
||||||
btn->CaptureMouse();
|
btn->CaptureMouse();
|
||||||
SetValue(val + delta);
|
SetValue(val + delta);
|
||||||
sendSpinEvent();
|
sendSpinEvent();
|
||||||
});
|
});
|
||||||
btn->Bind(wxEVT_LEFT_UP, [=](auto &e) {
|
btn->Bind(wxEVT_LEFT_UP, [=](auto &e) {
|
||||||
|
if (btn->HasCapture())
|
||||||
btn->ReleaseMouse();
|
btn->ReleaseMouse();
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
text_ctrl->SelectAll();
|
text_ctrl->SelectAll();
|
||||||
|
|
|
@ -134,6 +134,7 @@ void StepCtrl::mouseDown(wxMouseEvent &event)
|
||||||
if (rcThumb.Contains(pt)) {
|
if (rcThumb.Contains(pt)) {
|
||||||
pos_thumb = wxPoint{circleX, size.y / 2};
|
pos_thumb = wxPoint{circleX, size.y / 2};
|
||||||
drag_offset = pos_thumb - pt;
|
drag_offset = pos_thumb - pt;
|
||||||
|
if (!HasCapture())
|
||||||
CaptureMouse();
|
CaptureMouse();
|
||||||
} else if (rcBar.Contains(pt)) {
|
} else if (rcBar.Contains(pt)) {
|
||||||
if (pt.x < circleX) {
|
if (pt.x < circleX) {
|
||||||
|
|
Loading…
Reference in New Issue