TreeView in ScrolledWindow




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;
}




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