Jump to content
Server Maintenance This Week. ×

What does Resize to Fit really do?


jjjjp

This topic is 3399 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm confused about the meaning of the script step Adjust Window [Resize to fit]. The official Filemaker definition is that it "resizes the window to the minimum size possible while keeping all items in the layout visible."

I have many layouts that each show a different portal, and I have a button for each such layout that opens a window with the layout in it. I'd like the window to have no unnecessary space around the portal. Right now I keep global variables for the width and height of each layout (adding in a buffer below the portal and to the right). When the button is clicked, the window is sized according to the global variables. However, whenever I change the layout I must experiment until I have just the right size for the window, and then I must manually change the global variable. How much easier it would be to have a script step that did all that for me! But this is exactly what the definition of "Resize to fit" seems to promise, except that it isn't what happens, and respondents on the Forum seem to be saying that "Resize to fit" doesn't actually do what the definition says it does (without quite putting it that explicitly).

Should I simply give up on finding an automatic procedure for opening windows with the right dimensions? Perhaps I have been misinterpreting the definition of "Resize to fit."

Link to comment
Share on other sites

Draw a rectangle on the layout that encloses all the other objects such as the portal. When the window is re-sized it will shrink (or expand) to fit this rectangle. The rectangle can (should) be set to auto-size as the window changes: this does not change the effect of the re-size command since it shrinks the window to the minimum size of the objects.

I'm not sure why you need to keep track of layout size in global variables. Not only is in not necessary, it won't be cross-platform compatible because window sizes are slightly different between Mac and PC.

I define a rectangle for the layout size at the start of the design process and make sure each layout sticks with it. If I need to change one layout then I go back and change them all -- not a minor undertaking so there is time expended to get it right the first time. This creates a very consistent illusion of smoothness in navigation for the user.

  • Like 1
Link to comment
Share on other sites

"minimum size possible while keeping all items in the layout visible" means minimum - i.e. no "buffer" below and to the right.

You can use the Get (WindowHeight) and Get (WindowWidth) functions to set your variables. Or use them in your current script to add margins, after calling Adjust Window [Resize to fit].

Link to comment
Share on other sites

Thanks! I was having trouble getting things to work previously because I unthinkingly added the Adjust Window step after the Open Window step, rather than after the subsequent Go to Layout step. In any case, the rectangle idea works beautifully.

Link to comment
Share on other sites

  • 2 months later...

There is a gotcha: in list view the resize to fit command sets the window WIDTH to the minimum horizontal size, but the HEIGHT of the window is changed to fill the vertical space of the desktop. This is different from what happens in form view.

I set the window in a "blank" layout in form view (with the previously mentioned rectangle on it) and then change to the list view.

Link to comment
Share on other sites

  • 4 years later...

This topic is 3399 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.