Column titles incorrect when wxGrid::SetTable is used with native column header
|Reported by:||hajokirchhoff||Owned by:||VZ|
Calling SetTable sets up column headers with numbers from 1 to n if UseNativeColumnHeader() is active. It should call the virtual method GetColLabelValue of the wxGridTableBase derived class, but it doesn't.
In src/generic/grid.cpp (svn-head), at line 2350 is the following code
m_numRows = table->GetNumberRows(); m_numCols = table->GetNumberCols(); if ( m_useNativeHeader ) GetGridColHeader()->SetColumnCount(m_numCols); m_table = table;
GetGridColHeader()->SetColumnCount is called before the member variable m_table is set. This is wrong. SetColumnCount will setup the columns of the native column header and call wxGrid::GetColLabelValue. Since m_table is not yet set, the derived method cannot be called and the default column titles are used instead.
Solution should be easy: Move the statement
m_table = table;
up so that the variable is set before SetColumnCount is called.