8 Replies Latest reply on Jan 9, 2017 3:18 PM by BruceRobertson

    LayoutObjectAttribute isFront

    davidrto

      First post, so please be gentle. I searched the forum and didn’t see an answer to this.

       

      I’ve written a script to insert calculated result on slide panel change. It’s saved into a global field. But I can’t get the calculation to work.

       

      Where have I gone wrong? I’ve named each panel, specified the Layout::Object.

       

      Thanks!

       

      Case (

      (GetLayoutObjectAttribute ( "Workshops::BudgetSummary" ; "isFrontPanet") )=1 ;

      "1" ;

      (GetLayoutObjectAttribute ( "Workshops::BudgetLodging" ; "isFrontPanet") )=1 ;

      "2" ;

      (GetLayoutObjectAttribute ( "Workshops::BudgetVehicles" ; "isFrontPanet")) =1 ;

      "3" ;

      (GetLayoutObjectAttribute ( "Workshops::BudgetExpenses" ; "isFrontPanet")) =1 ;

      "4" ;

      (GetLayoutObjectAttribute ( "Workshops::BudgetCalculator" ; "isFrontPanet")) =1 ;

      "5" ;

      )

        • 1. Re: LayoutObjectAttribute isFront
          philmodjunk

          Did you use the inspector to give the panels the object names you used here in quotes? Are they in quotes when you check the object names via the inspector? (I make that last question, because "Workshops::BudgetSummary" has the the syntax used in FileMaker for accessing the value of a field and that might cause an issue here.

           

          Note that the panel's label and its object name are not the same. A Label is specified in Tab Control Setup and object names are specified in the Inspector.

           

          That said, here are some other comments:

           

          I you are using a recent version of FileMaker, there are two get functions that will return a value when the OnPanelSwitch trigger is tripped. GetTriggerTargetPanel will tell you (in list format), both the object name and the panel number of the tab or slide control panel brought to the front when that script trigger was tripped. This can make for simpler scripts and simpler expressions. Look this one up and use GetValue if you want to just get the number or just the object name.

           

          There are better options for setting a global field or variable to a value than Insert Calculated Result. This script step will not work if the global field is not present on your current layout. Use Set Field instead of Insert Calculated result to get a more consistent result and one that will avoid tripping layout script triggers (because Insert steps put the cursor in the field, this can trip a number of script triggers either currently set up on your layout or something that you might add in the future.)

          • 2. Re: LayoutObjectAttribute isFront
            davidrto

            Awesome info, thanks!

             

            Yes, I named the panels in the inspector. They are not in quotes in the Inspector.

             

            I’ll go through the rest of your post and see if I can get it working.

             

            FYI, my end goal is to have my button bar stay active state remain current with my slide panel when I slide, rather than use the buttons. I’ve seen a number of solutions for this online, but haven’t managed to get any of them to work properly, so I thought I’d just muddle through a solution on my own.

            • 3. Re: LayoutObjectAttribute isFront
              davidrto

              Set Field>Get(TriggerTargetPanel) is the solution for the first step, the global field is now updating properly. Thanks!

              • 4. Re: LayoutObjectAttribute isFront
                philmodjunk
                They are not in quotes in the Inspector.

                 

                But they should be given that you have object names in quotes in your GetLayoutObjectAttribute function calls.

                 

                I've played with the "button bar/slide control" setup myself. Much of the time, I decide that it's far simpler just to use a tab control with the tab labels in place of the button bar. The exception to this is when you want certain "tabs" to be invisible to selected users, then the ability to hide a button to make that tab disappear for those users becomes handy.

                • 5. Re: LayoutObjectAttribute isFront
                  davidrto

                  True, I could just disable swipe, and all would be fine. I do need to hone my scripting skills, though.

                   

                  Thanks again for the help. Much appreciated.

                  • 6. Re: LayoutObjectAttribute isFront
                    BruceRobertson

                    "I you are using a recent version of FileMaker, there are two get functions that will return a value when the OnPanelSwitch trigger is tripped. GetTriggerTargetPanel will tell you (in list format), both the object name and the panel number of the tab or slide control panel brought to the front when that script trigger was tripped."

                    Oops. Did it again.

                    Panel number and object name. In that order.

                    You'll always get the number. You will get the name, as the second value, if it exists.

                    • 7. Re: LayoutObjectAttribute isFront
                      philmodjunk

                      Bruce,

                       

                      There was no error in this post nor the previous similar one were you made the same comment.

                       

                      I didn't specify the order of the two values returned then and I didn't specify the order now, just indicated that both values are returned in a list. You might note the the follow on sentence tells them to look it up. That's so that they get the technical details straight when they try to implement.

                       

                      English is not a perfect medium of communication.

                      • 8. Re: LayoutObjectAttribute isFront
                        BruceRobertson

                        We disagree. It is impossible NOT to specify the order. Unlike layout objects, you cannot stack words on top of each other and present them simultaneously.

                        You mention one; and then the other. It would be better to specify them in the order in which the function provides them.

                        Yes, it can be of additional value to explicitly discuss the order the getValue method for extracting them.