gtk_container_add failed



I am creating an app with a button which is on the window with a pixmap.

 gtk-init (&argc, &argv); 
 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title (GTK_WINDOW (window), "MPI Company Ltd."); 
 gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_exit), NULL); 
 gtk_container_border_width (GTK_CONTAINER (window), 5); 
 style = gtk_widget_get_style(parent); 
 pixmap = gdk_pixmap_create_from_xpm (window, &mask,
         &style->bg[GTK_STATE_NORMAL],&file);         
 pixmapwid = gtk_pixmap_new (pixmap, mask);
 button = gtk_button_new_with_label ("beautiful");
 gtk_signal_connect (GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC (callback), (gpointer) "beautiful");
 gtk_container_add (GTK_CONTAINER (pixmapwid), button); 
 gtk_widget_show(button); 
 gtk_container_add (GTK_CONTAINER (window), pixmapwid);
 gtk_widget_show (pixmapwid);  
gtk_widget_show(window); 
 gtk_main ();


 When I app it, I get this:

Gtk-CRITICAL **: file gtkcontainer.c: line 712 (gtk_container_add): assertion
GTK_IS_CONTAINER(container) ' failed.

The button doesnot ON the pixmap!WHY?

How could I solve this?

weiwu



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