Jump to content
softtouch

Form designer width = client width?

Recommended Posts

When I create a new form in the designer, how do I know the actual form width to be able to set the constraints values (minwidth, minheight) to the same size as the form width and height? The width and height in the properties seems to be related to the client width, not like with a vcl form, the actual width including titlebar and border.

For example, when I drag/size the form in the designer to lets say 640x480, and set constraints minwidth and minheight to 640x480, I still can resize the form a little when running it.

Share this post


Link to post

The overall size of the form may vary from platform to platform (e.g. sizes of titlebar and border differ between Windows and macOS, and may differ between OS versions too).  So at design time you don't necessarily know what the overall width of the form will be.  It would make sense for Delphi to use width of the client area - since that value is known at design time.

 

If width is client width, then it would make sense for minwidth to be minimum client width also, so everything matches nicely - but I don't know whether that is the case.  If not, and minwidth is using the full width of the form, while width isn't, that seems unfortunate.  I believe minwidth is a new property for FMX in Alexandria though - perhaps it could use a tuneup.

 

Just a workaround thought:  If minwidth is including titlebar and border areas in its calculation, the RTL must have access to that all encompassing value, so your app may be able to query values once it is running, and set appropriate constraints at runtime, rather than design time.  The documentation has entries for both FMX TForm width and clientwidth properties, so you may have more options to play with at runtime.

Edited by Incus J
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×