Re: Help on finding size of drawing_area.



ehml <ehml pacific net sg> writes: 
> Let say I called the drawing_area widget da, then I found that
> 
>    (GTK_DRAWINGAREA(da))->widget.allocation.width == 1
>    (GTK_DRAWINGAREA(da))->widget.allocation.height == 1
>    (GTK_DRAWINGAREA(da))->widget.x = -1
>    (GTK_DRAWINGAREA(da))->widget.y = -1
> 
> This does not make sense to me.

The size is computed later, after the drawing area is actually on the
screen. 

You can't know the size before then, because you don't know what size
the window manager will give to your window.

You shouldn't need to know the size before then - the size will always
be OK when you get an expose_event, and that's when you want to draw. 
See the "scribble" example in the GTK tutorial.

Havoc



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