From e196db7b85c296f6a86e861aaabac8864768bd5e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 22 May 2010 15:43:00 +0000 Subject: [PATCH] Restore selection on click in row/column selection mode in wxGrid. This might be less consistent with the other selection modes but seems to be more convenient in practice, so restore the old, 2.8 behaviour and select the entire row/column on a simply click in row/column selection mode. Closes #12062. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 7ca5c3cdd9..315fbda05d 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3812,6 +3812,29 @@ wxGrid::DoGridCellLeftDown(wxMouseEvent& event, } else { + if ( m_selection ) + { + // In row or column selection mode just clicking on the cell + // should select the row or column containing it: this is more + // convenient for the kinds of controls that use such selection + // mode and is compatible with 2.8 behaviour (see #12062). + switch ( m_selection->GetSelectionMode() ) + { + case wxGridSelectCells: + case wxGridSelectRowsOrColumns: + // nothing to do in these cases + break; + + case wxGridSelectRows: + m_selection->SelectRow(coords.GetRow()); + break; + + case wxGridSelectColumns: + m_selection->SelectCol(coords.GetCol()); + break; + } + } + m_waitForSlowClick = m_currentCellCoords == coords && coords != wxGridNoCellCoords; SetCurrentCell( coords ); -- 2.45.2