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:
Vadim Zeitlin 2014-08-02 12:19:34 +00:00
parent c632599855
commit 220a8d1ac2

View File

@ -2347,12 +2347,15 @@ wxGrid::SetTable(wxGridTableBase *table,
m_numRows = table->GetNumberRows();
m_numCols = table->GetNumberCols();
if ( m_useNativeHeader )
GetGridColHeader()->SetColumnCount(m_numCols);
m_table = table;
m_table->SetView( this );
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 );
if (checkSelection)
{