Over 46,000+ Business Solution Developers Find answers, ask questions, and connect with our community of business solutions developers, business owners and partners.
Checking Screen Orientation in FileMaker Go – FileMaker Today
A reader asks: When developing for FileMaker Go, is it possible to write a script that does one thing do if the iPhone or iPad is held vertically and another if it’s held horizontally? How it could be done? “Yes we can!” (my son has been watching a lot of Bob the Builder). We need the Get ( WindowContentHeight ) and Get ( WindowContentWidth ) functions.
There are several other functions that can be used to get screen and window dimensions, but for some reason only the WindowContent functions actually return different values depending on whether the iOS device is in portrait or landscape orientation. On my iPad, here’s what these functions return:
Function | Portrait | Landscape |
---|---|---|
Get ( ScreenHeight ) | 1024 | 1024 |
Get ( ScreenWidth ) | 768 | 768 |
Get ( WindowHeight ) | 1024 | 1024 |
Get ( WindowWidth ) | 748 | 748 |
Get ( WindowContentHeight ) | 973 | 717 |
Get ( WindowContentWidth ) | 768 | 1024 |
So, if Get ( WindowContentWidth ) > Get ( WindowContentHeight ), your device is in landscape orientation, otherwise it’s in portrait orientation. Your script should test for this and do the appropriate thing:
If [Get ( WindowContentWidth ) > Get ( WindowContentHeight )] # it's in landscape… Else # it's in portrait… End If