GtkScrolledWindow signals



I'm trying to get a GtkScrolledWindow to notify via a scroll_child signal whenever the horizontal scrollbar is moved, but am having no success at all. The scrolled window contains a drawing are widget and the scrolled window itself is within a table widget. Everything works well except for the fact that I never get a scroll_child event. The commented out portion of the code has no effect if uncommented. Here's a simplified code snippit showing how it's all setup (note: the hardcoded numerics [800, 600, 2700, et al.] are there to simplify this snippit):
 
------------------------
GtkWidget * graph_area, * scrollwindow, * table, * window;
GtkWidget * hdr_window, * v_window;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy_event), NULL);
 
graph_area = gtk_drawing_area_new();
scrollwindow = gtk_scrolled_window_new(NULL, NULL);
table = gtk_table_new(3, 3, FALSE);
hdr_window = gtk_fixed_new();
v_window = gtk_drawing_area_new();
 
gtk_widget_set_size_request(hdr_window, 800, 30);
gtk_widget_set_size_request(v_window, 50, 570);
gtk_widget_set_size_request(graph_area, 2700, 570);
 
gtk_container_add(GTK_CONTAINER(window), table);
gtk_table_attach(GTK_TABLE(table), scrollwindow, 0, 1, 1, 2,
        GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
gtk_table_attach(GTK_TABLE(table), hdr_window, 0, 2, 0, 1,
        GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_table_attach(GTK_TABLE(table), v_window, 1, 2, 1, 2,
        GTK_SHRINK, GTK_FILL | GTK_EXPAND, 0, 0);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollwindow), graph_area);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwindow),
        GTK_POLICY_AUTOMATIC,  GTK_POLICY_NEVER);
 
g_signal_connect(G_OBJECT(v_window), "configure_event",
        G_CALLBACK(v_configure_event), NULL);
g_signal_connect(G_OBJECT(v_window), "expose_event",
        G_CALLBACK(v_expose_event), NULL);
g_signal_connect(G_OBJECT(graph_area), "configure_event",
        G_CALLBACK(configure_event), NULL);
g_signal_connect(G_OBJECT(graph_area), "expose_event",
        G_CALLBACK(expose_event), NULL);
 
g_signal_connect(G_OBJECT(scrollwindow), "scroll_child"
        G_CALLBACK(scroll_child), NULL);
 
/*
    I'm not sure when these are needed but I thought I'd give it a try anyway
    to no avail
 
gtk_widget_set_events(scrollwindow, GTK_SCROLL_MASK);
gtk_widget_set_extension_events(scrollwindow, GTK_EXTENSION_EVENTS_ALL);
*/
 
gtk_widget_show(graph_area);
gtk_widget_show(scrollwindow);
gtk_widget_show(hdr_window);
gtk_widget_show(v_window);
gtk_widget_show(table);
gtk_widget_show(window);
------------------------
 
I've searched through the archives and via google but haven't been able to find info on how to setup a scrolled window that uses the scroll_child signal. Any help would be much appreciated.
 
Tim
 


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