Re: TreeView in ScrolledWindow



Maybe you should use gtk_scrolled_window_add_with_viewport to add the
view into scrollwindow. like this:
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
view);


2007/9/14, q. <mailing-lists xs4all nl>:

Hello ppl,

I have a treeview that works and displays correctly, but when I try put it
into a scrolled window I run into some problems.

Unfortunatly I'm not fluent (yet) in GTK. As such I believe I mixed some
of the wrong properties. I have pasted the creation of the scrolled window
and the toplevel window below. I know the tree works good since I have
already tried it. But getting that thing in a scrolled window; somehow I
missed the point I'm affraid.

Any directions that would get me back on track are greatly appreciated.

Thankx!

int main(int argc, char *argv[]) {
 GtkWidget *window;
 GtkWidget *scrolled_window;
 GtkWidget *view;

 gtk_init(&argc, &argv);

 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
 gtk_widget_set_size_request(window, 300, 300);
 gtk_container_set_border_width(GTK_CONTAINER(window), 0);
 gtk_window_set_title(GTK_WINDOW(window), "Scrolled Treeview ?");

 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
 gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 10);
 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);

 view = create_view_and_model();
 gtk_container_add(GTK_CONTAINER(scrolled_window), view);

 gtk_widget_show_all(window);

 gtk_main();

 return 0;
}

_______________________________________________
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]