Re: [gtkmm] Changing columns in TreeView



> > What is the recommended method for changing the number of columns in a
> > TreeView on a ListStore model?
> > (eg. if the number of columns is dynamic based on some calculation,
> > triggered by user interaction).
>
> From this text I can't be sure if you want to change the number of view's
> or model's columns. You mix TreeView and ListStore.

Both.  Say the TreeView is being used to represent and edit a matrix of
numbers, where both dimensions can change.  Changing the number of rows is
easy, changing the columns isn't so obvious.

> > Is it possible to change the list of columns set in a ListStore (given
> in
> > the ListStore::create function), or is it necessary to create a new
> > ListStore?
>
> You can dynamically add columns both to view and store. Adding them to
> view is much easier. Adding model columns in runtime forces you to use not
> a very friendly set_value()/get_value() methods...

How is that done please?

I'm guessing it could be easier to create a new ListStore, attach it to the
TreeView and discard the original ListStore.  It seems an interface to
re-set the TreeModelColumnRecord on an existing ListStore would be useful,
rather than just in the create function.

eg:    void ListStore::reset(const TreeModelColumnRecord &columns);

Would this be possible, and improve the API of ListStore?

thanks,
Dan







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]