Re: A question about correct widget packaging sequence



Attilio,

The two code sequences seem right to me (certainly a bug in DFB) but I
prefer this packing order :

        box = gtk_hbox_new (FALSE, 6);
        gtk_container_add (GTK_CONTAINER (window), box);

        frame = gtk_frame_new("blah blah");
        gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 12);

        button = gtk_button_new_with_label ("Hello world!");
        gtk_container_add (GTK_CONTAINER (frame), button);

        gtk_widget_show_all (window);
        gtk_main ();

Like this, I don't forget to pack a widget!

Stephane

PS: Gnome HIG recommends multiple of 6 (not 5) (12 pixels is recommended
between the contents of a dialog window and the window borders)

PS2: Actual, GTK+ frame sucks !
http://developer.gnome.org/projects/gup/hig/2.0/design-window.html#layout-callouts-figure
We need a better API to do this easily (or GTK+ theme, I don't know) 

Le vendredi 29 juillet 2005 à 12:24 +0200, Attilio Fiandrotti a écrit :
hi everyone

we're trying to port the debian-installer gtk frontend from X to Direct
Frame Buffer: in the debian-installer gtk frontend code sequences of
instructions like this are often used


button = gtk_button_new_with_label("Hello world!");
frame = gtk_frame_new("blah blah");
gtk_container_add (GTK_CONTAINER (frame), button);
box = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5);
gtk_container_add(GTK_CONTAINER(window), box);
gtk_widget_show_all (window);
gtk_main ();

is this sequence correct?
If the same actions would be performed in this order

button = gtk_button_new_with_label("Hello world!");
frame = gtk_frame_new("blah blah");
box = gtk_hbox_new (FALSE, 5);
gtk_container_add(GTK_CONTAINER(window), box);
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5);
gtk_container_add (GTK_CONTAINER (frame), button);
gtk_widget_show_all (window);
gtk_main ();

would this piece of code still be correct?

I've noticed that under X both sequences work correctly, in a DFB
environement, instead, the second one produces crashes (but DFB is still
buggy, so maybe this doesn't means a thing..)
thanks

attilio

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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