Re: A question about correct widget packaging sequence
- From: Mike Emmel <mike emmel gmail com>
- To: fiandro tiscali it
- Cc: gtk-devel-list gnome org
- Subject: Re: A question about correct widget packaging sequence
- Date: Fri, 29 Jul 2005 07:40:55 -0400
It should not matter its a backend bug IMHO.
I tried both routes with this test program on the directfb backend and
they both worked for me. I think the second approach is cleaner code.
#include <gtk/gtk.h>
int main( int argc, char **argv ) {
GtkWidget *button;
GtkWidget *frame;
GtkWidget *box;
GtkWidget *window;
gtk_init(&argc,&argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
button = gtk_button_new_with_label("Hello world!");
frame = gtk_frame_new("blah blah");
#if 0
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);
#else
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);
#endif
gtk_widget_show_all (window);
gtk_main ();
}
On 7/29/05, Attilio Fiandrotti <fiandro tiscalinet it> wrote:
> 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-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]