6 Replies Latest reply on Sep 7, 2012 5:05 AM by jbante

    Lock layout in landscape on iPad

    ajayz

      Hello.

       

      I'm still finding my way around FileMaker as I've started moving from Microsoft Access and there are a few tricks I don't know yet.

       

      Questions:

       

      A) I have created a database that runs on the iPad in a landscape format. I want to lock the layout on the iPad to only landscape, I don't want they layout to chanage when turned to portrait

       

      B) I also would like to know if its possible to have two different layout (Landscape and portrait) and how I go about making the iPad select the correct layout when the ipad is rotated - if possible?

       

      ps remember I'm new to FileMaker and hence required a detailed response.

        • 1. Re: Lock layout in landscape on iPad
          beverly

          ajayz, there are similar threads on this forum. I searched for 'rotate' or 'landscape'. See if these help:

           

          1. https://fmdev.filemaker.com/message/82402#82402

          Subject:      Not allowing Filemaker Go to switch from landscape to portrait

          Date:      May 17, 2012

           

          2. https://fmdev.filemaker.com/message/89720#89720     

          Subject:      Just For Fun:  Triggering a script on iPad rotation

          Date:      July 28, 2012

           

          3. https://fmdev.filemaker.com/message/68496#68496

          Subject:      Auto change layout pending Portrait or Landscape

          Date:      January 28, 2012

           

          Beverly

          • 2. Re: Lock layout in landscape on iPad
            ajayz

            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.

            • 3. Re: Lock layout in landscape on iPad
              jbante

              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.

              • 4. Re: Lock layout in landscape on iPad
                beverly

                or teach the user how to lock the orientation on the iPad (regardless of application used). 

                 

                Beverly

                • 5. Re: Lock layout in landscape on iPad
                  ajayz

                  Hi Jbante,

                   

                  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?

                   

                  Thanks

                  • 6. Re: Lock layout in landscape on iPad
                    jbante

                    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:

                    1. 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.
                    2. 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.
                    3. 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.
                    4. 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.