[Solved] Resizable child windows with absolute margins
Posted: Tue Aug 02, 2011 04:48
Greetings.
I was wondering if there was any way, either programatically or via layout files, to specify that a child window should use the remaining space of a parent window, less absolute margins on the sides. More precisely:
I have a resizable FrameWindow that has certain widgets of fixed absolute position and size at the top (let's say 200 pixels for reasons of simplicity), and certain widgets at the bottom (let's say 50 pixels). I would like to place a ScrollablePane in the remainder of the area. If the height of the window is 'h', the available space should be 'h-250'. I would like this to be the size of the ScrollablePane.
Using ASCII art:
Now, getting the initial absolute position of the ScrollablePane isn't hard (it's 200 pixels), but I do not know how to specify the size. If I used an absolute size, it would not adjust as the parent FrameWindow is resized. If I use a relative one, it would, but the distance from the bottom of the window would not remain constant at 50 pixels, it would change.
Another similar but simpler problem is asking how to specify a widget that maintains an absolute gap of 4 pixels from the top and bottom of the window, which survives resizing. Again, the start position is easy, but the size is hard. This ends up being a second part of the above problem- if the top and bottom regions have a fixed absolute padding, you might want that same padding on the left and right too.
The workaround is to specify everything using relative coordinates, which doesn't work so well if part of the interface needs to remain fixed-size. Alternatively, you can always disable resizing and place everything using absolute coordinates.
Does anybody know how to solve this one?
I was wondering if there was any way, either programatically or via layout files, to specify that a child window should use the remaining space of a parent window, less absolute margins on the sides. More precisely:
I have a resizable FrameWindow that has certain widgets of fixed absolute position and size at the top (let's say 200 pixels for reasons of simplicity), and certain widgets at the bottom (let's say 50 pixels). I would like to place a ScrollablePane in the remainder of the area. If the height of the window is 'h', the available space should be 'h-250'. I would like this to be the size of the ScrollablePane.
Using ASCII art:
Code: Select all
+------------------+ -+ ---+
|Fixed-size widgets| | |
| | 200 |
+------------------+ -+-+ |
| | | h
| | | |
| ScrollablePane | (h-250) |
| | | |
| | | |
| | | |
+------------------+ -+-+ |
|Fixed-size widgets| 50 |
+------------------+ -+ ---+
Now, getting the initial absolute position of the ScrollablePane isn't hard (it's 200 pixels), but I do not know how to specify the size. If I used an absolute size, it would not adjust as the parent FrameWindow is resized. If I use a relative one, it would, but the distance from the bottom of the window would not remain constant at 50 pixels, it would change.
Another similar but simpler problem is asking how to specify a widget that maintains an absolute gap of 4 pixels from the top and bottom of the window, which survives resizing. Again, the start position is easy, but the size is hard. This ends up being a second part of the above problem- if the top and bottom regions have a fixed absolute padding, you might want that same padding on the left and right too.
The workaround is to specify everything using relative coordinates, which doesn't work so well if part of the interface needs to remain fixed-size. Alternatively, you can always disable resizing and place everything using absolute coordinates.
Does anybody know how to solve this one?