From be2e4015f5cf395d2a03034946ef62513ea4b103 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Wed, 30 Aug 2006 22:38:14 +0000 Subject: [PATCH] Only support detection of "near the edge" coordinates, if dragging grid lines is actually enabled (Fixes #548106 - Border of grid lines of wx.grid). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 90b76b3679..d91d508dd2 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -8532,15 +8532,23 @@ int wxGrid::XToCol( int x, bool clipToMinMax ) return GetColAt( maxPos ); } -// return the row number that that the y coord is near the edge of, or -// -1 if not near an edge +// return the row number that that the y coord is near +// the edge of, or -1 if not near an edge. +// coords can only possibly be near an edge if +// (a) the row/column is large enough to still allow for an "inner" area +// that is _not_ nead the edge (i.e., if the height/width is smaller +// than WXGRID_LABEL_EDGE_ZONE, coords are _never_ considered to be +// near the edge). +// and +// (b) resizing rows/columns (the thing for which edge detection is +// relevant at all) is enabled. // int wxGrid::YToEdgeOfRow( int y ) { int i; i = internalYToRow(y); - if ( GetRowHeight(i) > WXGRID_LABEL_EDGE_ZONE ) + if ( GetRowHeight(i) > WXGRID_LABEL_EDGE_ZONE && CanDragRowSize() ) { // We know that we are in row i, test whether we are // close enough to lower or upper border, respectively. @@ -8555,13 +8563,14 @@ int wxGrid::YToEdgeOfRow( int y ) // return the col number that that the x coord is near the edge of, or // -1 if not near an edge +// See comment at YToEdgeOfRow for conditions on edge detection. // int wxGrid::XToEdgeOfCol( int x ) { int i; i = internalXToCol(x); - if ( GetColWidth(i) > WXGRID_LABEL_EDGE_ZONE ) + if ( GetColWidth(i) > WXGRID_LABEL_EDGE_ZONE && CanDragColSize() ) { // We know that we are in column i; test whether we are // close enough to right or left border, respectively. -- 2.47.2