Re: Adding GtkTreeStore columns after instantiation.



On Sun, 2001-11-04 at 04:38, Jonathan Blandford wrote:
> murrayc t-online de (Murray Cumming) writes:
> 
> > gtk_tree_store_new() and gtk_tree_store_newv() allow us to specify the
> > number of columns, and the column types. Is it possible to add columns
> > to a GtkTreeStore after that?
> 
> The number of columns in a model is fixed.  This cannot change.

I was about to start ranting about this, wheeling about my standard
example of the grid widget that shows the results of lots of various SQL
queries. But then I realised that, if the nature of the data changes,
with different numbers and types of columns, then the Model itself
should probably change.

So is it possible to change the model used by a GtkTreeView after
instantiation? Will the TreeView respond automatically, suddenly showing
the new columns and rows properly?

> > I also noticed that GtkTreeView does have a
> > gtk_tree_view_append_column() function. But I guess that each
> > GtkTreeView column corresponds to a GtkTreeStore column. So what governs
> > the mapping?
> 
> No -- that's not the case.  You make a mapping from a column on the
> model to a property on a cell_renderer on a view_column.  This is a
> little confusing, unfortunately.  You might want to read a short paper I
> wrote on it at:
> 
>   http://people.redhat.com/jrb/files/treeview.tex

Thanks. That's a hugely useful document. Hopefully you plan to html-ize
it and/or add it to the GTK+ documentation.

-- 
Murray Cumming
murrayc usa net
www.murrayc.com




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