Re: [gtk-list] Re: gtk--: Problem with Gtk_Pixmap!



Tero Pulkkinen wrote:

> >
> >   GtkWidget * widget =GTK_WIDGET(gtkobject);
> >   pixmap = gdk_pixmap_create_from_xpm (widget->window, &mask,
> >                                          &style->bg[GTK_STATE_NORMAL],
> >                                          "3DRings.xpm");
> > now gives a warning that "window!=NULL".
>
> I've seen this problem already with 0.99.4...
>
> I think last time we fixed it by adding the widget to container and showing it
> before using the GTK_WIDGET(gtkobject)->window thingy... Guess gtk does not
> create the window now anymore if it really dont need it.

I added this code before creating a pixmap:

      /* Widget must be realized before we can attach a pixmap to it */
  if (widget->window == NULL)
         gtk_widget_realize (widget);
  pixmap = gdk_pixmap_create_from_xpm (widget->window,
            &mask,
            &widget->style->bg[GTK_STATE_NORMAL],
            fname);

and that seemed to take care of the problem.


...richie

--
* richieb@netlabs.net       - at home |  Richie Bielak          *
* richieb@calfp.com         - at work |                         *
*         Home page:   http://www.netlabs.net/hp/richieb        *
*         Fight software piracy, use free software! (me)        *





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