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:
|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…
# it's in portrait…