Recent

Author Topic: Windows 10 Maximize odd behaviour Lazarus Trunk  (Read 2162 times)

Josh

  • Hero Member
  • *****
  • Posts: 1270
Windows 10 Maximize odd behaviour Lazarus Trunk
« on: March 24, 2018, 12:54:26 am »
Hi

This is an odd one, and am pretty sure has only recently happened on trunk.

If you create a new application.
add a label on it and set it position to alBottom
run the application and maximize it; all ok. The label text appears above the taskbar.

If you now change the form constraints to limit the horizontal maximum to say 600; as you want full height but not width.
now run the application and maximize it, the label is at the bottom of screen; you will have to hide the taskbar to see it.

Is there a fix for this; or alternativelay how can I find the height of the visible taskbar, so that I can use the on resize to set components locations in this scenario.
« Last Edit: March 24, 2018, 01:32:26 am by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

ASerge

  • Hero Member
  • *****
  • Posts: 2212
Re: Windows 10 Maximize odd behaviour Lazarus Trunk
« Reply #1 on: March 24, 2018, 07:39:26 pm »
Is there a fix for this; or alternativelay how can I find the height of the visible taskbar, so that I can use the on resize to set components locations in this scenario.
Try this:
Code: Pascal  [Select][+][-]
  1. uses LclIntf, LclType;
  2. ...
  3. procedure TForm1.FormWindowStateChange(Sender: TObject);
  4.  
  5.   procedure AdjustMaxHeight;
  6.   var
  7.     BR: TRect;
  8.     WorkAreaHeight: Integer;
  9.   begin
  10.     BR := BoundsRect;
  11.     WorkAreaHeight := Screen.WorkAreaHeight;
  12.     if (BR.Bottom - BR.Top) > WorkAreaHeight then
  13.     begin
  14.       BR.Bottom := WorkAreaHeight - GetSystemMetrics(SM_CYMIN) - BR.Top;
  15.       BoundsRect := BR;
  16.     end;
  17.   end;
  18.  
  19. begin
  20.   if (WindowState = wsMaximized) and (Win32MajorVersion >= 10) then
  21.     AdjustMaxHeight;
  22. end;

By the way, in Delphi the error also happens.

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: Windows 10 Maximize odd behaviour Lazarus Trunk
« Reply #2 on: March 25, 2018, 03:13:41 am »
Thanks ASerge, I will add that into my default application template, basically a blank project with preset functions and behaviour built in..
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018