]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow minimal acceptable row height/column width to be set to 0 for
authorStefan Neis <Stefan.Neis@t-online.de>
Sat, 8 Nov 2003 18:58:04 +0000 (18:58 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Sat, 8 Nov 2003 18:58:04 +0000 (18:58 +0000)
        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

index ef6d26c36c00c5d897aa2accf921749c537aa6af..140e6333cd0782541f53fc1ca1a23b2f9ef00d0b 100644 (file)
@@ -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;
 };