gtk get actual pixel height of widget

Johnson Jones via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 5 08:23:15 PDT 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.





More information about the Digitalmars-d-learn mailing list