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