Ticket #15225 (closed defect: fixed)
wxGrid - calling AppendCols after SetColSize causes assert exception
|Reported by:||iwbnwif||Owned by:||vadz|
On wxMSW when using native drawn headers
If columns are appended to a wxGrid (using the method AppendCols) after some columns have already had their size set with SetColSize there is an assert exception raised.
This is because AppendCols causes GetColWidth to be called for all columns (including the newly appended one), however the m_colWidths array is only dimensioned to the existing columns (excluding the appended one).
A simple fix is to replace the m_colWidths.IsEmpty test at line 2567 of grid.cpp with m_colWidths.GetCount <= col.
However it might be better to rearrange the order in which the grid is updated so that the m_colWidths array is resized as part of the AppendCols actions. This is for someone who has much greater knowledge of how the wxGrid works than I do to decide!