From 20c84410479ba60b03289608a5e6893f2936133d Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sat, 8 Nov 2003 18:58:04 +0000 Subject: [PATCH] Allow minimal acceptable row height/column width to be set to 0 for hiding rows/columns. Only return true from CanEnableCellControl if a valid cell is selected (fixing Bug #837656). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24484 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 ef6d26c36c..140e6333cd 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -7478,7 +7478,9 @@ bool wxGrid::IsCurrentCellReadOnly() const bool wxGrid::CanEnableCellControl() const { - return m_editable && !IsCurrentCellReadOnly(); + return m_editable && (m_currentCellCoords != wxGridNoCellCoords) && + !IsCurrentCellReadOnly(); + } bool wxGrid::IsCellEditControlEnabled() const @@ -7741,7 +7743,10 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist, if ( coord >= BorderArray[i_max]) { i_min = i_max; - i_max = coord / minDist; + if (minDist) + i_max = coord / minDist; + else + i_max = BorderArray.GetCount() - 1; } if ( i_max >= BorderArray.GetCount()) i_max = BorderArray.GetCount() - 1; @@ -9486,14 +9491,18 @@ int wxGrid::GetRowMinimalHeight(int row) const void wxGrid::SetColMinimalAcceptableWidth( int width ) { - if ( width<1 ) + // We do allow a width of 0 since this gives us + // an easy way to temporarily hidding columns. + if ( width<0 ) return; m_minAcceptableColWidth = width; } void wxGrid::SetRowMinimalAcceptableHeight( int height ) { - if ( height<1 ) + // We do allow a height of 0 since this gives us + // an easy way to temporarily hidding rows. + if ( height<0 ) return; m_minAcceptableRowHeight = height; }; -- 2.49.0