7 Replies Latest reply on Aug 3, 2013 3:55 PM by chefportal

    Test for Iphone 5

    chefportal

      Hi All

       

      Is there a way to test for the Iphone5 and go to a layout specific to that screen size? I am new to scripting and understand how to get application version and go to layout for version but not sure how to test for screen size.

       

      Thanks in advance :-)

        • 2. Re: Test for Iphone 5
          chefportal

          Thanks Javier,

          I think I need to elaborate some more, as I may not have explained my problem well enough.

           

          I have an onOpen script that has

           

          If [PatternCount (Get (ApplicationVersion) ; “iPad”)]
          Go to Layout [“ some iPad layout “]
          Else If [PatternCount (Get (ApplicationVersion) ; “iPhone”)]  (need to incorperate screen size test here to iPhone 4 or iPhone 5 layout)
          Go to Layout [“ some iPhone layout “]
          Else
          Go to Layout [“ some layout “ ]
          End If

           

          As the iPhone 4 is the same platform as iPhone 5 I need to test for screen size greater than 429 px
          just not sure how to incorporate this into above script

          • 3. Re: Test for Iphone 5
            JavierDura

            You are in the right way.

            Add another condition to your "If" and it will be done:

             

            # It´s an iPad

            If [PatternCount ( Get ( ApplicationVersion ) ; “Go_iPad” ) = 1]

            Go to Layout [“some iPad layout"]

            # It´s an iPhone 5

            Else If [PatternCount ( Get ( ApplicationVersion ) ; “Go” ) = 1 AND Get(ScreenHeight)>479]

            Go to Layout [“iPhone 5 layout]

            Else

            Go to Layout [“somewhere else)]

            End If

             

             

             

            Please note that Get (ApplicationVersion) will never return "iPhone". It returns:

            Go version....... for FileMaker Go on the iPhone or iPod touch

            Go_iPad version........ for FileMaker Go on the iPad

             

             

             

            • 4. Re: Test for Iphone 5
              chefportal

              Thanks Javier you lead me in right direction, final code listed

               

              # Test for iPad

              If [ PatternCount ( Get ApplicationVersion ) ; "Go_iPad"  ) = 1]

                 Go to Layout ["iPad"]

              # Test for iPhone

              Else If [ PatternCount ( Get ApplicationVersion ) ; "Go" ) = 1 ]

              # Check screen height less than 435 then goto iPhone 4 layout

                 If [ Get ( WindowContentHeight ) < 435 ]

                    Go to Layout [ "iPhone4" ]

                 Else

              # Defaults to iPhone 5 in nested If statement 

                   Go to Layout ["iPhone5" ]

                End If

              Else

              # Defaults to Desktop layouut

                Go to Layout [ "DeskTop" ]

              End If

               

              Also attached file that has rotation layouts

              • 5. Re: Test for Iphone 5
                JavierDura

                Great!!

                • 6. Re: Test for Iphone 5
                  jbante

                  Won't that send you to the iPhone 4 layout if the user is on an iPhone 5 in landscape orientation? What about this instead:

                   

                  If [Max ( Get ( WindowContentHeight ) ; Get ( WindowContentWidth ) ) < 435 ]

                  • 7. Re: Test for Iphone 5
                    chefportal

                    Your right it does send to iPhone 4 if in Landscape, your solution works to fix this but if on the iPhone 4 in andscape it sends to iPhone 5 layout now.

                     

                    Seems like I need to add another test to trap this

                     

                    Although most users open App in Portrait will still like to fix this