Capture mouse while selecting rows/columns too

Change the logic in ChangeCursorMode() to explicitly exclude the modes
for which the mouse should not be captured, as CaptureMouse() should be
called in most cases (and ideally for all of them in the future) and do
capture it for WXGRID_CURSOR_SELECT_{ROW,COL} too, if only to be
notified about mouse capture loss.
This commit is contained in:
Vadim Zeitlin
2020-08-21 15:54:47 +02:00
parent 010007ba17
commit 408ebfd253

View File

@@ -4453,19 +4453,24 @@ void wxGrid::ChangeCursorMode(CursorMode mode,
break;
case WXGRID_CURSOR_MOVE_COL:
// Currently we don't capture mouse when moving columns, which is
// almost certainly wrong.
captureMouse = false;
win->SetCursor( wxCursor(wxCURSOR_HAND) );
break;
default:
case WXGRID_CURSOR_SELECT_CELL:
// Mouse is captured in ProcessGridCellMouseEvent() in this mode.
captureMouse = false;
wxFALLTHROUGH;
case WXGRID_CURSOR_SELECT_ROW:
case WXGRID_CURSOR_SELECT_COL:
win->SetCursor( *wxSTANDARD_CURSOR );
break;
}
// we need to capture mouse when resizing
bool resize = m_cursorMode == WXGRID_CURSOR_RESIZE_ROW ||
m_cursorMode == WXGRID_CURSOR_RESIZE_COL;
if ( captureMouse && resize )
if ( captureMouse )
{
win->CaptureMouse();
m_winCapture = win;