Re: Using Trees
- From: Murray Cumming <murrayc murrayc com>
- To: Joe LaBarbera <jlabarbera11 gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Using Trees
- Date: Sun, 27 Jun 2010 12:07:18 +0200
On Sat, 2010-06-26 at 14:28 -0400, Joe LaBarbera wrote:
> I was trying to append allow a user to click a button that would allow
> an additional column to be appended to my tree.
> This is what I have:
> void treetstruct::add_column()
> Gtk::TreeModelColumn<unsigned> newcol = columns.addcol();
> treeview.append_column_editable("New", columns.cols.back());
> Gtk::TreeModelColumn<unsigned> addcol()
> Gtk::TreeModelColumn<unsigned> newcol;
> return cols.back();
But your model knows nothing about these new columns.
TreeModelColumnRecord (your cols) is just a way to remember details
about model columns. You probably supplied it to a ListStore or
TreeStore create() method:
But your cols object is not shared. The model won't change in response
if you later change the TreeModelColumnRecord.
Basically, there is no TreeModel::add_column() method. You must recreate
your entire model when you want to add a column. I often wish that it
was more flexible, but it does make some sense: Adding a column means
that you've changed your data structure.
> The column will appear; however, when I attempt to change values, they
> are automatically erased, and there are many errors that appear in the
> command line. If anyone could help, even by providing additional
> information on trees in general, I would really appreciate it.
murrayc murrayc com
] [Thread Prev