A reader asks:
When developing for FileMaker Go, is it possible to write a script that does one thing 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
Be sure to view our webinar, Maximizing Mobility with FileMaker Go for more helpful design tips.
We enjoy sharing our thoughts on how to improve business workflows and optimize the performance of business applications. Check out our App Development Resources page to find more FileMaker tips, tricks and demos. We also offer FileMaker Training workshops and other support services to help you enhance your design and development skills.