Correct wxGrid column labels when using SetTable() with native header.
Ensure that the table pointer inside wxGrid is updated before initializing the native column header as it uses wxGrid::GetColLabelValue() which doesn't work correctly without a valid table pointer. Closes #16399. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2347,12 +2347,15 @@ wxGrid::SetTable(wxGridTableBase *table,
|
|||||||
m_numRows = table->GetNumberRows();
|
m_numRows = table->GetNumberRows();
|
||||||
m_numCols = table->GetNumberCols();
|
m_numCols = table->GetNumberCols();
|
||||||
|
|
||||||
if ( m_useNativeHeader )
|
|
||||||
GetGridColHeader()->SetColumnCount(m_numCols);
|
|
||||||
|
|
||||||
m_table = table;
|
m_table = table;
|
||||||
m_table->SetView( this );
|
m_table->SetView( this );
|
||||||
m_ownTable = takeOwnership;
|
m_ownTable = takeOwnership;
|
||||||
|
|
||||||
|
// Notice that this must be called after setting m_table as it uses it
|
||||||
|
// indirectly, via wxGrid::GetColLabelValue().
|
||||||
|
if ( m_useNativeHeader )
|
||||||
|
GetGridColHeader()->SetColumnCount(m_numCols);
|
||||||
|
|
||||||
m_selection = new wxGridSelection( this, selmode );
|
m_selection = new wxGridSelection( this, selmode );
|
||||||
if (checkSelection)
|
if (checkSelection)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user