that question is the same related to wxPython, see here.
I hope that the chances to get an answer is better with an C++ example.
I'm working with OS Win 7/wxWidgets v. 3.1.0. You can find that example "wxDataViewCtrl sample" in the folder samples\dataview, dataview.cpp.
It consits of an wxNotebook and four wxPanels. The last one contains an wxDataViewTreeCtrl. Code starts at line 730:
Code: Select all
case 3:
{
wxASSERT(!m_ctrl[3]);
wxDataViewTreeCtrl* tc =
new wxDataViewTreeCtrl( parent, wxID_ANY, wxDefaultPosition,
wxDefaultSize, style | wxDV_NO_HEADER );
m_ctrl[3] = tc;
wxImageList *ilist = new wxImageList( 16, 16 );
ilist->Add( wxIcon(wx_small_xpm) );
tc->AssignImageList( ilist );
wxDataViewItem parent =
tc->AppendContainer( wxDataViewItem(0), "The Root", 0 );
tc->AppendItem( parent, "Child 1", 0 );
tc->AppendItem( parent, "Child 2", 0 );
tc->AppendItem( parent, "Child 3, very long, long, long, long", 0 );
wxDataViewItem cont =
tc->AppendContainer( parent, "Container child", 0 );
tc->AppendItem( cont, "Child 4", 0 );
tc->AppendItem( cont, "Child 5", 0 );
tc->Expand(cont);
}
break;
Code: Select all
tc->AppendTextColumn( ??? );
Code: Select all
line 583:
wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
wxAlignment align = wxALIGN_NOT,
int flags = wxDATAVIEW_COL_RESIZABLE );
line 607:
wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
wxAlignment align = wxALIGN_NOT,
int flags = wxDATAVIEW_COL_RESIZABLE );
Many thanks and greetings
widgetsfox