1
votes

I made a basic GtkGrid application with a simple layout but I can't make the GtkGrid fill the entire GtkWindow. This is the code for creating the layout:

GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);


GtkWidget *grid = gtk_grid_new();
g_signal_connect(window,"destroy", G_CALLBACK(gtk_main_quit), NULL);

GtkWidget *vpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);

gtk_paned_set_position (GTK_PANED (vpaned), 400);

GtkWidget *label = gtk_label_new("Label1111111111111111111111111111111");
GtkWidget *label2 = gtk_label_new("Label2");
GtkWidget *label3 = gtk_label_new("Label3");
GtkWidget *label4 = gtk_label_new("Label4");
gtk_paned_pack1 (GTK_PANED (vpaned), label, FALSE, TRUE);
gtk_paned_pack2 (GTK_PANED (vpaned), label2, FALSE, TRUE);

gtk_widget_show (label);
gtk_widget_show (label2);
gtk_widget_show (label3);
gtk_widget_show (label4);
gtk_widget_show (vpaned);

gtk_grid_attach(GTK_GRID(grid), label3, 0,0,1,1);
gtk_grid_attach(GTK_GRID(grid), vpaned, 0,1,1,1);
gtk_grid_attach(GTK_GRID(grid), label4, 0,2,1,1);

gtk_widget_show(grid);

gtk_container_add(GTK_CONTAINER(window), grid);

gtk_widget_show (window);
1
ProTip: use gtk_widget_show_all (GTK_WIDGET (window)) gets rid of 7 calls to gtk_widget_showdrahnr
Can you add a screenshot?drahnr

1 Answers

4
votes

You may have a look at expand property and assure it is set to TRUE (default if you do your UI within glade designer)