Question re configure_event.



Hi ..

I have an application with a number of windows, each with a drawing area, and 
pixmap associated with it.

At start-up all of the windows are created, but NOT displayed - various buttons
display these as required.

Now I need to write to one of the drawing areas BEFORE the window has ever been
displayed, and had a configure_event.

If I try to "draw" to the drawing area I get things like:

Gdk-CRITICAL **: file gdkdraw.c: line 89 (gdk_draw_rectangle): assertion `drawable != NULL' failed.

If I expose the drawing area (giving it a configure_event) PRIOR to attempting 
to draw to it, everything is okay.

My configure events for the drawing area looks like:

//////////////////////////////////////////////////
gboolean
on_guiFastHenryVertViaDrawingArea_configure_event
                                        (GtkWidget       *widget,
                                        GdkEventConfigure *event,
                                        gpointer         user_data)
{
 if (guiGlobalVariablesFastHenryVertViaDrawingAreaPixMap == NULL ) {
  guiGlobalVariablesFastHenryVertViaDrawingAreaPixMap = gdk_pixmap_new(
                                                          widget->window,
	 	                                          ( (widget->allocation.width) ),
	 	                                          ( (widget->allocation.height) ),
	 	                                          -1
                                                         );
  gdk_draw_rectangle (guiGlobalVariablesFastHenryVertViaDrawingAreaPixMap,
	 	      widget->style->black_gc,
		      TRUE,
		      0, 0,
		      ( (widget->allocation.width)  ),
		      ( (widget->allocation.height)  )
                     );
 }

  return FALSE;
}
//////////////////////////////////////////////////

My understanding is the the configure_event is fired either when the window is CREATED or resized.

Without "reveiling" the window, how can I "fake" a window creation, and get the window set up ready to
be drawn to ?

Fingered-crossed on a potential workaround ;-)

Best regards

/colin.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Colin Thomas. 
| Design Consultant.                             
|                                           
| Email   : colin designresources co uk     
| Tele    : (44) 1234 240562 
| Fax     : (44) 1234 241262               
|                                           
| Address : Design Resources,
|           Old Cock Inn,    
|           Silver End,         
|           Olney,                           
|           Buckinghamshire,                
|           United Kingdom.                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





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