Re: Help requested with drawing lines in a child window.



Hi,

"Michael John Holme" <M Holme doc mmu ac uk> writes:

> Gdk-CRITICAL **: file gdkdraw.c: line 65 (gdk_draw_line): assertion
> 'drawable != NULL' failed.
> 
> I understand that I'm calling gtk_draw_line with a NULL first parameter, but
> why is it NULL.

Because you passed the pointer to the GdkWindow of the drawing_area 
widget which is what you are supposed to do. The problem is that this 
pointer is only set after the widget has been realized. A simple 
solution is to force realization of the widget by calling 
gtk_widget_realize(). Alternatively you can connect to the realize signal 
of the widget and do the drawing there. What you want to do actually is 
to create your window with the drawing area and everything, connect to 
the expose_event signal of the drawing_area and draw your lines in the 
expose_event handler. That way the lines will also be redrawn correctly 
if your window is exposed after being hidden (for example by another 
window). IIRC, there is a quite good example in the GTK+ tutorial.


Salut, Sven




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