Re: pixmaps/windows.




Joshua Richardson <jric@bu.edu> writes:

> > I'm in a slight catch 22. I want to have a pixmap, but I don't want to
> > show the window until the pixmap is added to it. So at runtime, it
> > complains "creating pixmap from xpm with null window and colormap".
> > (I'm guessing because the window is not shown...)
> > 
> > How do I solve this?
> > 
> gtk_widget_realize()?

gtk_widget_realize causes the widget->window to be filled in, which
will solve your warnings. (You are passing in a NULL to
the window argument of gtk_pixmap_create_from_xpm())

Howver, gtk_widget_realize() can also have some less good
side effects. (For instance, if you realize a widget that
doesn't have a parent yet, it will appear as a toplevel
window.). A better solution is to use a slightly different
form of the pixmap creation call.

 GdkColormap *colormap;

 colormap = gtk_widget_get_colormap (widget);
 pixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap,
                                               &mask, NULL, "myfile.xpm");

Regards,
                                        Owen




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