Gtk: How can they share a widget?



Please help me!!!!!!!

I was working on resizing and repositioning of image drawing widgets.
Unfortunately, I have errors and I do not know how to solve it.
I put a part of my code on the bottom.

The error is,
"Gtk-CRITICAL **: file gtkwidget.c: line 3359 (gtk_widget_set_parent):
assertion `widget->parent == NULL' failed."
It is issued from "gtk_fixed_put (GTK_FIXED(fixed), RxCam[num].button,
160*i, 120*j);" in the "for" loop.

If I move the gtk_fixed_put () before gtk_table_attach_default(), then
gtk_table_attach_default() has error message like the above.

I guess gtk_table_attach_default() and gtk_fixed_put() conflict each
other caused by R[num].button widget.

How can I solve the conflict?

Regards,
bkna.




GtkWidget *makeFixedContainer(GtkWidget *window) {
 int i, j, num;
 GtkWidget *table;
 GtkWidget *fixed;

 fixed = gtk_fixed_new ();
 gtk_widget_show (fixed);

 table = gtk_table_new(2, 2, FALSE);
 gtk_box_pack_start (GTK_BOX(window), table, FALSE, TRUE, 0);

 for(j = 0; j < 2; j++) {
   for(i = 0; i < 2; i++) {
     num = i + 2 * j;
     R[num].myid = num;
     R[num].button = gtk_button_new();
     R[num].fixed = fixed;

     gtk_table_attach_defaults (GTK_TABLE(table), R[num].button, i, i +
     1, j, j + 1);

     R[num].darea = gtk_drawing_area_new ();
     gtk_drawing_area_size (GTK_DRAWING_AREA(R[num].darea), 100, 100);
     gtk_container_add (GTK_CONTAINER(R[num].button), R[num].darea);
     gtk_widget_realize (R[num].darea);

     gtk_signal_connect (GTK_OBJECT(R[num].button), "clicked",
                                          GTK_SIGNAL_FUNC(resize),
                                            &RxCam[num]);

     gtk_fixed_put (GTK_FIXED(fixed), R[num].button, 100*i, 100*j);
   }
 }

 gtk_container_add (GTK_CONTAINER (window), fixed);

 return table;
}









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