Dynamically add/remove columns in Gtk::TreeView

Dear developers,

I am struggling with dynamically adding columns to Gtk::TreeView. I work with Code::Blocks and C++ and I have attached my example code as PDF here.

Basically I want to have 4 permanent cols in my TreeView and add/remove dynamic columns of the same type. All works except storing data in the columns. I do not know how to access specific columns within a row. I have taken the example from the gtkmm documantation. My basic problem is in the ‘dyncol_on_cell_data()’ and ‘dyncol_on_edited()’ functions where I should store the text in a row and get the text out of the same row. Adding the columns, the renderer etc. works but this ModelColumn stuff does not…

I hope I find somebody here who could help me. My dynamic columns would use the same callbacks since they are identical, only the stored data are unique.

Later I want to import/export all data from my TreeView into some (e.g. csv) file.

Thank you in advance for your help.

TestTreeViewDynCols.pdf (450.0 KB)