Recent

Author Topic: [SOLVED] How to query the outer size of a 'TForm' ?  (Read 1855 times)

dsiders

  • Hero Member
  • *****
  • Posts: 1280
Re: How to query the outer size of a 'TForm' ?
« Reply #30 on: October 15, 2024, 12:41:29 am »
It's even in the FAQ.
::)

BTW. I expected this piece of crucial information to be in the normal docs, where there is no mention of it. Especially because it's different behavior from Delphi.

Fair enough.

I have topics updates that's are pending for 4.0. Let me review what it would take to apply them for 3.8.

I have an update ready that changes ClientHeight, ClientWidth, Height and Width. For example:

Code: Text  [Select][+][-]
  1. TControl.ClientHeight
  2. The height for the client area on the control.
  3.  
  4. ClientHeight is an Integer property with the number of pixels needed for vertical
  5. client area on the control. The property contains the value from the Bottom
  6. member in ClientRect. Changing the value for ClientHeight causes SetClientSize
  7. to be called to apply the existing ClientWidth and the new value for the property.
  8.  
  9. The value for ClientHeight is not stored or used to set the Height for the control
  10. during LCL component streaming. It is used, however, when AutoSizing is restored
  11. and when auto-layout policies using Anchors are applied to the control. For example,
  12. when Anchors is set to [akBottom] the value in ClientHeight is needed / used.
  13.  
  14. In the LCL, ClientHeight has the same value as Height. Derived classes (like
  15. TCustomForm or TForm) may implement a ClientHeight property that differs from Height -
  16. but in the current LCL version, they do not. This differs from the behavior in the Delphi
  17. VCL where a TForm instance adjusts the value in ClientHeight to remove pixels used in
  18. non-client areas like the title bar, borders, frames, and scroll bars. LCL uses this approach
  19. because there is no reliable way to determine the sizes for all of the non-client areas on all
  20. of the platforms where LCL is supported. Without a reliable way, the LCL would needlessly
  21. move the forms around on the screen or resize them endlessly. In the LCL, neither Height
  22. nor ClientHeight include the non-client area on a form instance. The height of a TMainMenu
  23. instance is omitted from both values as well.
  24.  
  25. Use ClientWidth to access the number of pixels needed for the horizontal client area on the control.
  26.  
  27. See Also
  28.     TControl.ClientRect
  29.     TControl.ClientWidth
  30.     TControl.Height
  31.     TControl.AutoSizing
  32.     TControl.EnableAutoSizing
  33.     TControl.AutoAdjustLayout
  34.     TControl.Resize
  35.     TControl.Anchors

I plan to apply it to both fixes_3_0 (for the release in 3.8) and in fixes_4.

Feedback appreciated.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

Hartmut

  • Hero Member
  • *****
  • Posts: 843
Re: [SOLVED] How to query the outer size of a 'TForm' ?
« Reply #31 on: October 15, 2024, 10:55:11 am »
Feedback appreciated.

Thank you very much dsiders for your continuous and valuable work on the documentation. I'm not familar with all aspects you have written (like AutoSizing or Anchors) but from what I understand it is a good and very helpful text.

 

TinyPortal © 2005-2018