Re: resizing a drawingarea

Hi Kees,

On Sun, 10 Apr 2011 11:19:01 +0200 you wrote:
> On 04/10/2011 10:30 AM, Povietkin Konstantin wrote:
> > В Вск, 10/04/2011 в 08:53 +0200, Kees Kling пишет:
> >>
> >> I have a widget derived from Gtk::DrawingArea. This widget is placed in
> >> a window. So far so good, but when I resize the window, the size of the
> >> drawingarea stays the same. What must I do about that.
> >>
> > You should use Gtk::Viewport.
> Do you mean deriving from Gtk::Viewport or adding the widget to a 
> viewport, because the latter doesn't work for me

I can't imagine why Konstantin thought a viewport was what you need. A
viewport is a device for making a large unshrinkable widget fit in a
small window by adding scroll bars.

Unless I'm mistaken, a DrawingArea just presents somewhere to use the
graphics primitives. It has very little inherent functionality. I
assume you're using the on_expose_event hook to do some drawing? I
think for resizing you will need to do something in the
on_size_allocate hook too. And you'll need to modify the drawing
algorithms in on_expose_event to take account of the new size.



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