Re: Forcing size_allocate?



Paul Davis <pbd op net> writes:

> >I have a gnome_canvas packed into a vbox.  All drawing in the canvas is
> >connected to a size_allocate event because I need to know the width and
> >height of the area before drawing.  
> 
> don't do this. a size allocate will always be followed by an expose
> event. all drawing must be done from the expose event handler, always.
> just store the width and height in the size allocate handler for later
> use. if for some reason, the expose event is really missing, use
> gtk_widget_queue_draw() to cause one to occur "soon".

Note also that you can simply get the current width and height
of the canvas with:

 canvas->allocation.width
 canvas->allocation.height

Regards,
                                        Owen
 



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