Titlebarheight lazarus / 31-LCL ---------------------------------------------------------------------- winni · 2019-11-06 19:27 Hi! On gtk2 and other widgetsets this is not implemented: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TBarHeight := GetSystemMetrics(SM_CYCAPTION); And a lot of docs say that it is impossible to figure out. So let's do the impossible. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TitleBarHeight (Form: TForm) : Integer;var ws : TWindowState;    oldheight : integer;beginws := Form.WindowState;if ws <> wsMaximized then  begin   oldHeight := Form.Height;   Form.WindowState := wsMaximized;   repeat   Application.ProcessMessages; // let Form expand   until Form.Height <> oldHeight; // but one ProcessMessages is [b]not [/b]enough!   end;result := Screen.Height -Form.Height;if ws <> wsMaximized then  begin  Form.WindowState := ws; // and back again  Application.ProcessMessages;  end;end;                 Works ok with linux/gtk2. Don't know about other widgetsets. Winni ---------------------------------------------------------------------- lucamar · 2019-11-06 21:10 Instead of:   Screen.Height you should use:   Form.Monitor.WorkAreaRect.Height It'll encompass more situations; like, say, a Gnome desktop with top and/or bottom system-bars Note also that a form might be full-Height yet not be maximized, in which case your Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  repeat   Application.ProcessMessages;   until Form.Height <> oldHeight;will produce a infinite loop. You should check for that situation. ---------------------------------------------------------------------- winni · 2019-11-06 22:12 Two times right: Form.Monitor.WorkAreaRect.Height may be needed for situations that I don't know: System-bar at bottom of KDE screen, but reports correct height. It was so easy then, when we had 640 x 480 pixel ..... And the rare sitation that the height is = height as maximized is solved with a loop counter: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var count : integer = 0;...   repeat   Application.ProcessMessages; // let Form expand   inc (Count);   until (Form.Height <> oldHeight) or (count > 10); I kept trace who often the loop is done, interesting enough: If you start the function in a startup situation, it needs sometimes  2 loops and sometimes only 1 loop. If you start it when the app is not busy, then it needs only 1 loop. Thanks for the hints! Winni