Re: Error output - completion with code



On Fri, Mar 30, 2001 at 02:47:30PM +0100, Christian. Schleippmann wrote:
> Hi again,
> below is the part of my code. By the way, I have used parts of the tutorial
> point 6 (gtk.org) "buttons.c" example programme. There happens the same
> problem! So, if we find the bug, we can also improve the (already well done)
> tutorial!
> 
> Cheers
> Christian
> 
> one more comment:
> The function "xpm_label_box(window, "info.xpm", "Grey RoI");" to initialise my
> boxes is also from the tutorial.

What is happening is that gtk_pixmap_new is being called with val == NULL (bad thing) which in turn means gdk_pixmap_create_from_xpm is failing (also bad thing) which in turn means something you have to figure out but which will tell you how to fix your code.

My first guess was not realizing the widget passed in but you are apparently doing that..
Second guess is that your program is having grave difficulties finding the info.xpm file. I wonder did you know you were supposed to have it? :) hehe
Don't know what else it might be.

> 
> Code:
> int main( int   argc,
>    char *argv[] )
> {
>   /* GtkWidget is the storage type for widgets */
>   GtkWidget *window;
>   GtkWidget *button1, *button2, *button3, *button4;
>   GtkWidget *box1, *box2, *box3, *box4;
>   GtkWidget *fixed;
> 
> 
>   gtk_init (&argc, &argv);
> 
>   /* Create a new window */
>   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> 
>   gtk_window_set_title (GTK_WINDOW (window), "Image processing");
> 
>   /* It's a good idea to do this for all windows. */
>   gtk_signal_connect (GTK_OBJECT (window), "destroy",
>         GTK_SIGNAL_FUNC (gtk_exit), NULL);
> 
>   gtk_signal_connect (GTK_OBJECT (window), "delete_event",
>         GTK_SIGNAL_FUNC (gtk_exit), NULL);
> 
>   /* Sets the border width of the window. */
>   gtk_container_set_border_width (GTK_CONTAINER (window), 80);
>   gtk_widget_realize(window);
> 
>   /* Create new buttons */
>   button1 = gtk_button_new ();
>   button2 = gtk_button_new ();
>   button3 = gtk_button_new ();
>   button4 = gtk_button_new ();
> 
>   /* Connect the "clicked" signal of the button1 to our callback */
>   gtk_signal_connect (GTK_OBJECT (button1), "clicked",
>         GTK_SIGNAL_FUNC (call1), (gpointer) "Grey RoI");
> 
>   /* Connect the "clicked" signal of the button2 to our callback */
>   gtk_signal_connect (GTK_OBJECT (button2), "clicked",
>         GTK_SIGNAL_FUNC (call2), (gpointer) "Colour RoI");
> 
>   /* Connect the "clicked" signal of the button3 to our callback */
>   gtk_signal_connect (GTK_OBJECT (button3), "clicked",
>         GTK_SIGNAL_FUNC (call3), (gpointer) "Grey Mask");
> 
>   /* Connect the "clicked" signal of the button4 to our callback */
>   gtk_signal_connect (GTK_OBJECT (button4), "clicked",
>         GTK_SIGNAL_FUNC (call4), (gpointer) "Colour Mask");
> 
> 
>   /* This calls our box creating function */
>   box1 = xpm_label_box(window, "info.xpm", "Grey RoI");
>   box2 = xpm_label_box(window, "info.xpm", "Colour RoI");
>   box3 = xpm_label_box(window, "info.xpm", "Grey Mask");
>   box4 = xpm_label_box(window, "info.xpm", "Golour Mask");
> 
>   /* Pack and show all our widgets */
>   gtk_widget_show(box1);
>   gtk_widget_show(box2);
>   gtk_widget_show(box3);
>   gtk_widget_show(box4);
> 
>   gtk_container_add (GTK_CONTAINER (button1), box1);
>   gtk_container_add (GTK_CONTAINER (button2), box2);
>   gtk_container_add (GTK_CONTAINER (button3), box3);
>   gtk_container_add (GTK_CONTAINER (button4), box4);
> 
>   gtk_widget_show(button1);
>   gtk_widget_show(button2);
>   gtk_widget_show(button3);
>   gtk_widget_show(button4);
> 
>   fixed = gtk_fixed_new();
>   gtk_container_add(GTK_CONTAINER(window), fixed);
>   gtk_widget_show(fixed);
> 
>   /* position of buttons in window container */
>   gtk_fixed_put (GTK_FIXED (fixed), button1, 50, 50);
>   gtk_fixed_put (GTK_FIXED (fixed), button2, 50, 100);
>   gtk_fixed_put (GTK_FIXED (fixed), button3, 150, 50);
>   gtk_fixed_put (GTK_FIXED (fixed), button4, 150, 100);
> 
>   gtk_widget_show (window);
> 
>   /* Rest in gtk_main and wait for the fun to begin! */
>   gtk_main ();
> 
>   return(0);
> }
> 
> 
> 
> 
> 
> > > I get several error outputs in the programme evoking shell from GTK+
> > > (see below). There is so far no problem with the programme itself,
> > > however, I would like to get rid of this outputs. How can I suppress
> > > them?
> >
> >
> > You're doing something with a yet uninitialized widget (widget != NULL).
> > You should send parts of you code that could have to do with this for us to
> > make sense out of this, I guess...
> >
> > check your code for gtk_widget_show(widget); commands where you didn't
> > initialize the widget yet (i.e. widget = gtk_....._new(.....);)
> >
> > Ronald
> >
> > --
> > ---------------------------------------------------.
> > --   .-.    | Ronald Bultje                        |
> > --   /V\    | Running: Linux 2.4.2 and OpenBSD 2.8 |
> > --  // \\   | E-mail : rbultje ronald bitfreak net |
> > -- /(   )\  | WWW    : http://ronald.bitfreak.net/ |
> > --  ^^-^^   |    *** Warning: Unix Addicted ***    |
> > ---------------------------------------------------'
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list




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