8 Replies Latest reply on Sep 23, 2014 3:00 PM by hamish

    Slide Control panels and script triggers

    hamish

      Title

      Slide Control panels and script triggers

      Post

      Can you attach a script to a panel change in a slide control. eg when you swipe a panel to change to next panel can a script be activated. Its probably simple but I cant get my head around it.

        • 1. Re: Slide Control panels and script triggers
          philmodjunk

          It may help to think of Slide Controls as a special kind of tab control as the same features for script triggers also work with Slide Controls.

          There are two triggers that you can use. One performs the script before the panel change in the Slide Control and one that Performs the script after the change. OnPanelSwitch is performed before the change and you can use Get ( TriggerTargetPanel ) to determine the index and/or the object name of the new panel. OnObjectModify will be performed after the panel change and you can use GetLayoutObjectAttribute with the IsFrontPanel attribute to determine the object name of the newly visible panel.

          You may want to examine the use of Slide Controls in the final Exploration layout of Adventures in FileMaking #2. In there, slide controls are used inside three different popovers as a way to trip a script. In each case, I used OnObjectModify as I wanted to see the slide animation take place before the script modified data to change what appeared next in the panel of the slide control. (This creates the illusion of an unlimited series of Slide control panels when there is actually only three panels in the Slide control.) There's a file inside global field on this layout that you can export in order to acquire a "Date picker" that can be used on an iOS device in place of the "spinning wheels" data picker. You swipe the control sideways to move through the months of this calendar style date picker.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Slide Control panels and script triggers
            hamish

            Thanks, I think I see now.

            Another One

            If I am in panel 2 of a slide control in portrait and then switch orientation to landscape on changing to a landscape layout, the slide control always comes up with panel 1. How do I make it go to the same panel? There are 5 panels. Thanks.

            • 3. Re: Slide Control panels and script triggers
              philmodjunk

              Exactly what happens when you change device orientation? Are you using the OnLayoutSizeChange trigger to change layouts?

              If you are using two layouts, one for each orientation, then you need to use identical object names for the panels of the slide controls on both layouts and then use go to object to specify the current panel you want to be visible on the new layout.

              • 4. Re: Slide Control panels and script triggers
                hamish

                If you are using two layouts, one for each orientation, then you need to use identical object names for the panels of the slide controls on both layouts(have done this) and then use go to object to specify the current panel you want to be visible on the new layout.(how do I do this as I have 5 panels and can only assign scripts to a layout or a slide control not individual panels, I think I am missing something. I have named the panels Page1,Page2,Page3,Page4 and Page5)

                • 5. Re: Slide Control panels and script triggers
                  philmodjunk

                  But each time you change panels, you can trip a script trigger and the trigger performed script can identify the current panel and set a global variable to the name of that panel. Then, when the orientation change takes place, the script that changes layouts can also use go to object to go to the same panel on the other layout.

                  And OnRecordLoad can be used to set this variable to the name of the default panel so that you start out "in synch" whenever you change records.

                  • 6. Re: Slide Control panels and script triggers
                    hamish

                    I'm still having problems can you give me an example script to identify the current panel and set a global variable to the name of that panel. 

                    • 7. Re: Slide Control panels and script triggers
                      philmodjunk

                      The OnPanelSwitch trigger might perform this script:

                      Set Variable [$$CurrentPanel ; value: GetValue ( Get ( TriggerTargetPanel ) ; 2 ) ]

                      Then your script that responds to on LayoutSizeChange can include:

                      Go to Object [$$CurrentPanel ] --> don't put variable name in quotes here

                      • 8. Re: Slide Control panels and script triggers
                        hamish

                        Many many thanks it took me a while but it now works fine