Re: [gtk-list] Re: GDK, and `gdk_pixmap_create_from_xpm_d': NULL window



> A widget's window is NULL until it has been realized,
> realization occurs sometime after you've done the gtk_widget_Show()
> (which realizes then maps the widget to the screen).
> (I say sometime as it's not immediate :-)...you'll get an expose
> event for the drawing area once it's visible.)
> There are ways to force reallization...not usually considered good
> design decisions, however (though there are exceptions).

okay, i start to understand, i think... 

> Have you tried gdk_pixmap_colormap_create_from_xpm()?
> The first parameter is also a window, but it can be specified
> as NULL if you supply a colormap (the 2nd parameter).
> You could supply the drawing area's colormap, (or the system colormap
> with gdk_colormap_get_system()). And I believe the rest of the parameters
> match the xpm_d() function you are using now.

thank you, it did the job... 
or almost... as my code now fails on another part.. 
here's the scheme: 
	step 1: create a drawing_area widget, initialize the 
		data that will have to be drawn unto it, 
		connect a couple of signals, 
		associate that data with the object 
		(gtk_object_set_data).
	step 2: show the widget
		this will first call whatever has been associated
		to the configure_event (drawing all the background
		stuff unto an offscreen pixmap, a pixmap which is
		also associated with the widget in it's user data),
		and afterwards it ought to call whatever has been
		connected to the expose_event (which simply draws
		the pixmap created into the configure_event unto
		the screen). 
	bummer: this scheme works up unto the configure_event handler,
		the expose_event handler is never called. 
		Prior to it's call, the following error is
		generated:

Gdk-ERROR **: BadAlloc (insufficient resources for operation)
  serial 490 error_code 11 request_code 53 minor_code 0

and this time I'm sure I've allocated enough memory... 
what the hell (sorry) does this error mean? 

> Or, you could wait until you know the drawing area has been realized...just
> depends on whether you are trying to set things up "in advance".

I'm indeed doing the latter... and setting things up in advance,
like loading the background image that will eventually have to be shown
anyway... 

> Hope that helps!

it did help indeed, many thanks already,

Nancy



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