August 05, 2017
I am trying to set positions of widgets automatically. e.g., I have a paned widget and I to set the position of the handle manually based on a percentage of the window. e.g., 0.5 will set the handle midway and both children will have the same height. I 0.2 will set it to to 20%.

I want it to retain this proportion when the window is resized.

The problem is I cannot get get the paned widgets actual height(nor the handle size).

paned.getHeight() returns -1.

If I use the main window's height, things go wonky because, I guess the border size and title bar size skew the calculations.

I'm still learning this api and how it all functions and works. Some things are not so obvious nor logical. getHeight should return the height. If -1 means "leave it up to the internals" then there should be some other height function that works like getActualHeight() but there isn't or I can't find anything that works.

If I do

										writeln(mainPaned.getAllocatedHeight());
										writeln(mainPaned.getChild1.getAllocatedHeight());									writeln(mainPaned.getChild2.getAllocatedHeight());



then I get something like

800
1
1

where 800 is the height I used to set the window using

auto width = 1000, height = 800;
mainWindow.resize(width,height);

which, I'd expect it to actually be smaller as either it doesn't take in to account the titlebar or the resize function above is not for the full application window.



August 05, 2017
On Saturday, 5 August 2017 at 15:23:15 UTC, Johnson Jones wrote:
> I am trying to set positions of widgets automatically. e.g., I have a paned widget and I to set the position of the handle manually based on a percentage of the window. e.g., 0.5 will set the handle midway and both children will have the same height. I 0.2 will set it to to 20%.
>
> [...]

Sorry, I think I was running my code before the window was actually being shown and I guess these values are not set until the actual display of the window.