Re: xpm problem



Am Mon, 2001-12-03 um 07.45 schrieb Diwakar:
> 
> Hi there!!!,
> 
> I am using the following code to put a pix map into a widget. During compile
> time there is no error but during execution the following error occured. Can
> any one tell me why? Also if possible tell me how do I put a gif file into a
> widget?
> 
> Thanks for quick reply.
> 
> Warning:
> Gdk-WARNING **: Creating pixmap from xpm with NULL window and colormap
> 
> Code:
> 
> #include <stdio.h>
> #include <mysql/mysql.h>
> #include <gtk/gtk.h>
> 
> static int show=0;
> 
> void destroy1(GtkWidget *wtemp,gpointer data)
> {
>         gtk_widget_destroy(wtemp);
>         show=0;
> }
> void about()
> {
>         GtkWidget *w2;
>         GtkWidget *l2;
>         GtkWidget *b3;
>         GtkWidget *box;
>         GtkStyle *style;
>         GdkPixmap *pixmap;
>         GtkWidget *pixmapwid;
>         GdkBitmap *mask;
> 
>         char pic_path[25]="../gui/logo1.xpm";
> 
>         if(show==0)
>         {
>                 w2=gtk_window_new(GTK_WINDOW_TOPLEVEL);
>                 gtk_window_set_title(GTK_WINDOW(w2),"About Box");
>                 gtk_container_set_border_width(GTK_CONTAINER(w2),12);
>                 box=gtk_vbox_new(FALSE,3);
>          /* Add the Pixmap*/
>                 style=gtk_widget_get_style(w2);
> 
You should put a "gtk_widget_realize(w2);" here, I think that solves
your problem.

> pixmap=gdk_pixmap_create_from_xpm(w2->window,&mask,&style->bg[GTK_STATE_NORM
> AL],pi
> c_path);
>                 pixmapwid=gtk_pixmap_new(pixmap,mask);
>                 gtk_box_pack_start(GTK_BOX(box),pixmapwid,FALSE,FALSE,3);
>                 l2=gtk_label_new("Copy Rights Infinite 2000-2001");
>                 gtk_box_pack_start(GTK_BOX(box),l2,TRUE,TRUE,0);
>                 b3=gtk_button_new_with_label("OK");
>                 gtk_box_pack_start(GTK_BOX(box),b3,TRUE,TRUE,0);
>                 gtk_container_add(GTK_CONTAINER(w2),box);
> 
> gtk_signal_connect_object(GTK_OBJECT(b3),"clicked",GTK_SIGNAL_FUNC(destroy1)
> ,GTK_OBJECT(w2));
>                 gtk_widget_show_all(w2);
>                 show=1;
>         }
> 
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list
> 
> 

Greetings,
Jörgen

-- 
There are two major products that come from Berkeley : LSD and UNIX. We
don't believe this to be a coincidence.

Jeremy S. Anderson




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