gtk-bin.c error when using frames



Hi:

I get the following error when I try to use frames to pack widgets. It is just a test application I wrote to learn GTK/GNOME programming:


Gtk-CRITICAL **: file gtkbin.c: line 217 (gtk_bin_add): assertion `bin->child == NULL' failed.


Below is the code I used. It's mostly from this book that I bought.

Thanks.

-D



In the main function ...


   // create the toolbar
   gnome_app_create_toolbar(GNOME_APP(topLevelWindow), toolBar);

   // create source frame
   frame = makeFrame();
   gtk_container_add(GTK_CONTAINER(topLevelWindow), frame);

   gtk_widget_show(topLevelWindow);
   gtk_main();
   exit(0);
}

.....



This the function that creates the frame.

GtkWidget *makeFrame(void) {
	GtkWidget *box;
	GtkWidget *frame;
	GtkWidget *label;

	box = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(box);

	label = gtk_label_new("Test Label");
	gtk_widget_show(label);
	gtk_container_add(GTK_CONTAINER(box), label);

	label = gtk_label_new("Another Label");
	gtk_widget_show(label);
	gtk_container_add(GTK_CONTAINER(box), label);

	frame = gtk_frame_new("Just a label");
	gtk_widget_show(frame);
	gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
	gtk_container_add(GTK_CONTAINER(frame), box);

	return (frame);
}

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





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