Hello. I want to put some widget in a scrolled window, but I want it initially displayed in its full size. The scroll bars will be useful when the top level window becomes smaller. The problem is that the scrolled window seems to allocate space enough only to the scroll bars. See the attached program and screenshot as an example. I would like the first button the be fully visible initally. Any clues on how to get that? Romildo
// scrwin1.c #include <gtk/gtk.h> int main(int argc, char *argv[]) { gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Tree view test 1"); gtk_container_set_border_width(GTK_CONTAINER(window), 5); g_signal_connect(G_OBJECT(window), "destroy", gtk_main_quit, NULL); GtkWidget *box = gtk_hbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(window), box); GtkWidget *scrwindow = gtk_scrolled_window_new(NULL, NULL); gtk_box_pack_start_defaults(GTK_BOX(box), scrwindow); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GtkWidget *button1 = gtk_button_new_with_label("Button 1"); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrwindow), button1); GtkWidget *button2 = gtk_button_new_with_label("Button 2"); gtk_box_pack_start_defaults(GTK_BOX(box), button2); gtk_widget_show_all(window); gtk_main(); return 0; }
Attachment:
scrwin1.jpg
Description: JPEG image