Hello,

Le 10/08/2007, "Prasanna Kumar K" <[EMAIL PROTECTED]> a écrit :
>  gtk_box_pack_start (GTK_BOX(hbox), treeview, TRUE, TRUE, 0);
>  gtk_box_pack_start (GTK_BOX(hbox), vscroll, TRUE, TRUE, 0);
>  gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, 1);
>  
> the problem is, in hbox the width of hbox is equally divided for both
> treeview and vscroll.
Normal, because you ask your widgets to expand in the available area.
It is the meaning of the TRUE value you gave to the
gtk_box_pack_start(). Give a look to the documentation for the exact
meaning of these arguments
(http://developer.gnome.org/doc/API/2.0/gtk/GtkBox.html). So calling
instead:
  gtk_box_pack_start (GTK_BOX(hbox), treeview, TRUE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX(hbox), vscroll, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, 1);
will do the job. *But* this is not the right way to do!

To have a scrollable treeview, you should put it *inside* a
GtkScrolledWindow
(http://developer.gnome.org/doc/API/2.0/gtk/GtkScrolledWindow.html). So
you should call instead:

scrollwindow = gtk_scrolled_window_new((GtkAdjustment*)0,
(GtkAdjustment*)0);
gtk_box_pack_start(GTK_BOX(vbox), scrollwindow, TRUE, TRUE, 1);
gtk_container_add(GTK_CONTAINER(scrollwindow), treeview);

This will create a scrollable treeview. Use the
gtk_scrolled_window_set_policy() routine if you don't want to see the
horizontal scrollbar.

Damien.

PS : the GtkTreeview widget come with its own internal scroll support
(but not scroll rendering), so we directly add it (with
gtk_container_add()) into the scrolled_window instead of creating a
viewport as explained in the tutorial
(http://www.gtk.org/tutorial/x1370.html).
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to