ajayz, there are similar threads on this forum. I searched for 'rotate' or 'landscape'. See if these help:
Subject: Not allowing Filemaker Go to switch from landscape to portrait
Date: May 17, 2012
Subject: Just For Fun: Triggering a script on iPad rotation
Date: July 28, 2012
Subject: Auto change layout pending Portrait or Landscape
Date: January 28, 2012
Thanks for the reply, however the point 1 - had no replies (which suits my first question)' the others weren't that helpful either.
I'm after just a simple solution to stop portrait on an form within my database to start with.
Locking a layout to portrait or landscape orientation is not possible in FileMaker Go. Your options are to design a layout with objects that stretch and reposition for different orientations, or to design separate layouts for each orientation and switch between them with an OnTimer trigger. I can't vouch for the feasibility of this next idea I just had, but it might be worth trying if only to see if it works: design the form layout, then duplicate it and rotate everything 90 degrees to create your "landscape in portrait" effect, and have the OnTimer trigger switch between those two layouts — of course this will only make sense if your layout fits in the iPad screen with no scrolling.
or teach the user how to lock the orientation on the iPad (regardless of application used).
I think the Ontimer trigger is what I may need.
I created the two laylays as you suggested, a landscape layout called "Fusion" and a portrait format call "Fusion Portrait" - I have filemaker 12 and I will be using the latest Ipad with Filemaker GO version 12, but i'm not sure how to go about writing this scrip - are you able to help?
The second discussion Beverly linked to included a file demonstrating the technique. But I saw that it was in the .fp7 format, so I made a .fmp12 file to demonstrate instead. There are 3 mandatory parts, and one optional part:
- OnLayoutEnter trigger — when you enter a layout you want to have this layout-switching functionality, you need to tell the OnTimer trigger which layouts to switch between, and you need to start it.
- OnLayoutExit trigger — when you leave a layout, you want to turn the layout-switching off, in case you're switching to a layout that doesn't do the same thing.
- OnTimer trigger — this is the meat of the process. Every time it runs, it compares the window height and width to decide what orientation it's in, and switches layouts accordingly.
- Startup — for this demo file, I set the interval for checking orientation to a global variable at start-up. It can just as easily be set in the OnLayoutEnter trigger, but putting it in the global variable makes it easier to keep consistent if I have multiple OnLayoutEnter triggers that include starting the OnTimer trigger as a step. If you have FileMaker Pro Advanced, I recommend using a custom function that returns a constant value instead, since it isn't dependent on the start-up script for getting set and it wont pollute the data viewer when you don't need to see it.
You'll notice in the "Check Orientation OnTimer" script that I rigged it to not switch layouts if the user is in a field. Switching layouts while the user is entering data can be disorienting. Since I don't usually do this sort of layout switching unless I'm showing very different layouts in the different orientations — like a list view in portrait and a chart on a form view in landscape — this works fine for me. If you want the layout to switch even while the user is in a field, you probably want to augment the script to put the user back in the same field (and with the same active selection/cursor position) after the layout switch.
RotationDemo.zip 10.2 K