I'm dealing with some window management issues and I'm wondering how I can get the true width and height of a given layout to resize the window to fit the information precisely.
Anyone have any techinques to achieve this?
No need to work it out, use the Adjust Window [ resize to fit ] script step.
The size of the window borders can vary with platform and version, and possibly user preference, so getting the "layout" dimensions might not be too useful anyway.
Works ok with form view... Not so much with List (depending on record count can be to tall)
Get ( WindowHeight ) and Get ( WindowWidth ) (also Get ( WindowContentHeight ) and Get ( WindowContentWidth ) ) are available calculation functions you can utilise. Try creating a calc using these, put it on your layout if needed (or just display it in the data viewer of you have FMP Advanced), make the window the size you want and the calc will display the dimensions, which you can then use to set your window.
I will often use these Get Window functions and the window position to make sure that a window is not opening wider than the users desktop since that is annoying. You can do an If function that tests if the content width is wider than the desktop width and if so, only make it as wide as the desktop width. The same works for height. I make it part of the startup script usually.
Retrieving data ...