dunbarx wrote: ↑Mon Dec 11, 2023 2:53 am
Wouldn't setting the rect of the card window to the screenRect do the job?
Craig
I suspect
@trailboss may be alluding to the layout on the screen - I mean on windows the 'maximise window' button essentially does this for you.
But it doesn't change the layout. I suspect what the OP is really asking about is a responsive layout.
I know you know all of the below well Craig, but I'm including a high level summary for the benefit of @trailboss.
There are a few ways to adapt your app to varying screen sizes - some more complex than others.
If the aim is to stick to the same scale of objects, one can use the
on stackResize handler to reposition/resize objects. This is complex and arduous, especially if you have no experience doing this.
The Geometry manager kinda works and does the same thing quicker but is quirky and if an error occurs it can scatter the objects to the 4 corners of the globe, so would only recommend this if the developer already had experience in how to manage this. As for the responsiveLayout external - I personally cannot recommend this at present, it's problematic and has so little documentation as to be unusable, for me anyway.
Perhaps the
simplest way to make your app fit a smaller screen is to adjust the the
scaleFactor of the stack to a smaller value, eg 0.7 (the default is 1). This enlarges or shrinks the stack proportionally (the scaleFactor can be set in code or using the stack's property inspector - it's in the first panel 'basic')
One could look at checking size compared to the screenRect in the
on resizeStack handler and adjusting the scaleFactor accordingly or have some other scheme to automatically magnify/shrink the stack as needed.
Personally I usually use some combination of stackResize handler and the Geometry manager. I always start by defining the smallest possible size required by the stack and then set the min width/height in the stack's properties to these - in general it's easier to grow things proportionally than squeezing them into a small card where things may begin to overlap. I then implement in various ways how objects on the card will resize and/or reposition. In this, it's useful to group objects to minimise the about of work needed (i.e. move a group of controls instead of each individually).
If creating a busy app, this
will take up a large chunk of time and code. The way around this (and I'll admit I've done this some apps where it's been usable and time has been critical) is to change the scaleFactor of the stack and not bother with resizing/repositioning controls.
HTH
Stam