Re: Multiple stores for TreeView



On Thu, 2003-04-03 at 02:10, mige wrote:

I have several GtkListStore, but only one at the time displayed in a 
GtkTreeView.
What is the best way to implement this ?
1.
- create only one GtkTreeView
- Every time user select a list-store
    - Clean-up treeview (remove all the columns, set treeview's model to 
null)  
    - Fill-up treeview (set treeview's model to list-store and build up 
the columns)

This is easy since whe have a model/view relationship the view doesn't
hold any "real" information.  Just use
   
void gtk_tree_view_set_model         (GtkTreeView *tree_view,
                                      GtkTreeModel *model);

This will unset the current model and set the new one.  If you just want
to unset the current model then send in a NULL for the model.  Make sure
you have a refrence to the model if you wish to reuse it.  The models
must have identical metadata (i.e. # of columns and column data types).


2.
- create a GtkTreeView for each list-store
- Every time user select a list-store
    - Hides the old tree-view
    - Shows the treeview hold the store
Use a widget like the tabbed pane widget. There might also be a card
widget that stacks panes on top of each other without using tabs but I
could just be getting my GUI libraries mixed up.  Either way there is a
widget that does this.  Check out www.gtk.org and look at the API
documentation.

--
J5


Or any other way are welcome...

Thank you

regards,
mige

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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