]> git.saurik.com Git - wxWidgets.git/commitdiff
Restore selection on click in row/column selection mode in wxGrid.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 22 May 2010 15:43:00 +0000 (15:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 22 May 2010 15:43:00 +0000 (15:43 +0000)
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

index 7ca5c3cdd97a6c075a8c83faa039a9bbc6ab057b..315fbda05d02276e0e0a84710e0eab4e697ddd27 100644 (file)
@@ -3812,6 +3812,29 @@ wxGrid::DoGridCellLeftDown(wxMouseEvent& event,
         }
         else
         {
         }
         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 );
             m_waitForSlowClick = m_currentCellCoords == coords &&
                                         coords != wxGridNoCellCoords;
             SetCurrentCell( coords );