GNOME Bugzilla – Bug 1261
Table expansion is a little strange.
Last modified: 2011-02-04 16:11:52 UTC
Package: gtk+ Version: 1.2.2 When creating a table, sometimes space gets allocated incorrectly. For example, look at the following sample code: #include <gtk/gtk.h> gint main (gint argc, gchar **argv) { GtkWidget *table, *window, *button1, *button2, *button3; gtk_init (&argc, &argv); window = gtk_window_new (GTK_TOPLEVEL); table = gtk_table_new (2, 2, FALSE); button1 = gtk_button_new_with_label ("Top"); button2 = gtk_button_new_with_label ("Left"); button3 = gtk_button_new_with_label ("Right"); gtk_table_attach (GTK_TABLE (table), button1, 0, 2, 0, 1, GTK_FILL|GTK_EXPAND, 0, 0, 0); gtk_widget_set_usize (button1, 300, 20); gtk_table_attach (GTK_TABLE (table), button2, 0, 1, 1, 2, 0, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), button3, 1, 2, 1, 2, GTK_EXPAND, 0, 0, 0); gtk_container_add (GTK_CONTAINER (window), table); gtk_widget_show_all (window); gtk_main (); } Button 1 sets the horizontal space that the table uses as it is much larger then combined width of buttons 2 and 3. GtkTable then allocates the extra space evenly between the two buttons. I think that, as button3 has an expand flag, and button2 does not, button3 should get all the space. -Jonathan ------- Bug moved to this database by debbugs-export@bugzilla.gnome.org 2001-01-27 14:46 ------- This bug was previously known as bug 1261 at http://bugs.gnome.org/ http://bugs.gnome.org/show_bug.cgi?id=1261 Originally filed under the gtk+ product and general component. Reassigning to the default owner of the component, gtk-bugs@gtk.org.
Changing this can't be done in 1.2.x since it might break desired layouts.
*** Bug 52807 has been marked as a duplicate of this bug. ***
Was fixed prior to 2.0.0. Sun Mar 3 15:16:07 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtktable.c: When increasing the row or column requisitions to make them sufficient for spanning widgets, favor rows or columns with expandable children in them. (#1261, Jonathan Blandford.)