Re: tree_view
- From: André Pedralho <apedralho gmail com>
- To: srinivas comodo com
- Cc: gtk-app-devel-list gnome org
- Subject: Re: tree_view
- Date: Fri, 24 Jun 2005 16:35:37 -0400
It is not an easy task to create and begin to populate a tree view.
You have to set a lot of others widgets, but I'll show you a short
code to help you.
GtkWidget *treeStore, *treeView
GtkTreeViewColumn *column1, *column2...;
GtkCellRenderer *renderer1,*renderer2...;
treeStore = GTK_TREE_MODEL(gtk_tree_store_new(2,G_TYPE_STRING,G_TYPE_STRING));
treeView =
gtk_tree_view_new_with_model(GTK_TREE_MODEL(treeStore));
/* optional settings */
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (treeView), TRUE);
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (treeView), TRUE);
gtk_tree_view_set_reorderable(GTK_TREE_VIEW (treeView), TRUE);
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW (treeView), TRUE);
gtk_widget_show(treeView);
/* setup the renderer */
renderer1 = gtk_cell_renderer_text_new();
gtk_cell_renderer_set_fixed_size (renderer1,100,-1);
column1 = gtk_tree_view_column_new_with_attributes("Name", renderer1,
"text", 0, NULL);
gtk_tree_view_column_set_resizable (column1, TRUE);
gtk_tree_view_append_column(GTK_TREE_VIEW(bwin->treev),
column1);
gtk_tree_view_set_expander_column(GTK_TREE_VIEW(bwin->treev),column1);
/* you could make the same for the others columns and renderer or just
use the same renderer for all of them */
gchar *text1= "any text";
GtkTreeIter *newIter, *parentIter;
/* now you can append your item. if newIter is NULL, it will be the
root of the tree */
gtk_tree_store_append(GTK_TREE_STORE(treeStore),newIter,parentIter);
gtk_tree_store_set(GTK_TREE_STORE(treeStore), newIter, 0,text1, -1);
So... it is just a begining... Look at the api and the following tutorial:
http://scentric.net/tutorial/treeview-tutorial.html
I hope I could help you!
On 6/24/05, srinivas <srinivas comodo com> wrote:
hi ;
i have a pbm in populating the tree_view, i want to populate
tree_view using file path got from gtk_file_selection_get_filename(fs),
how could i populate tree_view. how to insert file selection path to the
tree_view widget.
Thanks®ards;
srinivas
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
André Pedralho
Bachelor in Computer Science
Instituto Nokia de Tecnologia
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]