Sign up

How much space is in the middle of a layout?

I have a window with some buttons at the top (in a horiz Box), a label at the bottom, and a DrawingArea in the middle, all in a vert Box.

I want the DrawingArea to occupy all the available space in the middle.

After showAll() I call getSize() to retrieve the actual window size.

But how can I find out how much space is available in the middle so that I can call DrawingArea.setSizeRequest() to occupy all the available space?

Re: How much space is in the middle of a layout?

On Mon, 17 Feb 2020 09:15:44 GMT, mark wrote:

I have a window with some buttons at the top (in a horiz Box), a label at the bottom, and a DrawingArea in the middle, all in a vert Box.

I want the DrawingArea to occupy all the available space in the middle.

After showAll() I call getSize() to retrieve the actual window size.

But how can I find out how much space is available in the middle so that I can call DrawingArea.setSizeRequest() to occupy all the available space?

Can you post some code? It's hard to know what's missing without seeing what you have.

Re: How much space is in the middle of a layout?

On Mon, 17 Feb 2020 18:47:57 GMT, Ron Tarrant wrote:

On Mon, 17 Feb 2020 09:15:44 GMT, mark wrote:

I have a window with some buttons at the top (in a horiz Box), a label at the bottom, and a DrawingArea in the middle, all in a vert Box.

I want the DrawingArea to occupy all the available space in the middle.

After showAll() I call getSize() to retrieve the actual window size.

But how can I find out how much space is available in the middle so that I can call DrawingArea.setSizeRequest() to occupy all the available space?

Can you post some code? It's hard to know what's missing without seeing what you have.

I don't have the code now. I ended up not needing it.

The problem was that I hadn't understood various aspects of GtkD's layout system. Now when I add the DrawingArea to the Box I set expand and fill to true and for the DrawingArea subclass I have setRedrawOnAllocate(true) and now when I resize the containing window the DrawingArea gets resized and its onDraw() is called -- so everything now "just works".