diff --git a/docs/changes.txt b/docs/changes.txt index 9fff4549f4..dfac2d9424 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -95,6 +95,8 @@ All (GUI): - Added wxWindow::GetNextSibling() and GetPrevSibling() - Support wxGRID_AUTOSIZE in wxGrid::SetRow/ColLabelSize() (Evgeniy Tarassov) +- Ensure that wxGrid::AutoSizeColumn/Row() never sets column/row size + smaller than the minimal size All (Unix): diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 76af28f3df..6ca379e10e 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -10529,6 +10529,12 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column ) if ( column ) { + // Ensure automatic width is not less than minimal width. See the + // comment in SetColSize() for explanation of why this isn't done + // in SetColSize(). + if ( !setAsMin ) + extentMax = wxMax(extentMax, GetColMinimalWidth(col)); + SetColSize( col, extentMax ); if ( !GetBatchCount() ) { @@ -10544,6 +10550,12 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column ) } else { + // Ensure automatic width is not less than minimal height. See the + // comment in SetColSize() for explanation of why this isn't done + // in SetRowSize(). + if ( !setAsMin ) + extentMax = wxMax(extentMax, GetRowMinimalHeight(row)); + SetRowSize(row, extentMax); if ( !GetBatchCount() ) {