11 Replies Latest reply on Jun 3, 2011 1:53 PM by philmodjunk

    Get ( ActiveLayoutObjectName )

    2b3Productions(IanS)

      Title

      Get ( ActiveLayoutObjectName )

      Post

      This function doesn't seem to work. I've tried tabbing to the object, clicking on the object, and trying to using Data Viewer to monitor the values as it supposedly "refreshes", but it doesn't seem to work. 

      Ultimately, I'm trying to get it to work on a button, such that when someone clicks on the button I can use the button name in a calculation.

      Is there another way to just "get the name of the object" for conditional formatting calculations?

      (There are times when I wish FM was a bit more truly "object" oriented.)

        • 1. Re: Get ( ActiveLayoutObjectName )
          philmodjunk

          First, layout objects only have names if you enter layout mode, select the object and then enter an object name in the Name box at the top of the Inspector's Position tab.

          Second, odd as this might seem, clicking a button does not make it the active layout object so you cannot click a button and then use this function to extract the button's object name. To make a button "active" it has to be part of the tab order and you have to tab into the button object.

          The work around is to use a script parameter to pass the info you want into your script so that your script can tell what button was clicked to perform the script. (If you can't figure that method out, describe what you are trying to do and I'll post a more detailed example.)

          • 2. Re: Get ( ActiveLayoutObjectName )
            2b3Productions(IanS)

            Thank you for the response. I am currently using the Script Parameter method you just described for my solution. I am just looking for a more elegant solution as I have many buttons and formatting rules that would just be easier if it could be based off the object name entered once.

            However, I still would like to know how to use this Get ( ActiveLayoutObjectName ) function as it seems to not work in any scenario in which I expect it to work, even if in Layout mode I have assigned a name to the object. I have also changed tab order to test tabbing through from object-to-object (tabbed to it in the case of a button). I have tested putting my cursor into a named-object text field manually. I would expect Get ( ActiveLayoutObjectName ) under Data Viewer to show the current Active Layout Object Name but it doesn't.

            Any further ideas? I cannot get this function to output anything helpful.

            • 3. Re: Get ( ActiveLayoutObjectName )
              philmodjunk

              Say you have a field  and give it the object name: "Field A".

              Tab or click in this field and Get ( ActiveLayoutObjectName ) should return "Field A".

              Name a button, "Button 1'.

              Make sure that this button is part of the tab order.

              Press tab and/or shift - tab until the button shows that it is current.

              Get ( ActiveLayoutObjectName ) should then return "Button 1".

              Note that clicking on a button, as I said previously, does not make it the current object and this somewhat counter-intutive detail is what usually trips people up when they try to use this function in a script to acquire info about the button that was clicked to perform the script.

              Note that a calculation field, whether stored, unstored, or global will not update to return the object name when the focus moves to a different object.

              • 4. Re: Get ( ActiveLayoutObjectName )
                aammondd

                I seem to remember something like this not too long ago :)

                 

                • 6. Re: Get ( ActiveLayoutObjectName )
                  johnhorner

                  i ran into a similar issue trying to use this function.  i have a tabbed panel with a different portal in each tab.  i have a container field that has a graphic to indicate just above each tab if there are records present (non-empty portal rows) in each portal.  i want the graphic to disappear when you are on a particular tab (i.e. when you click to tab three the indicator for tab three will disappear and then re-appear when you click to a different tab).  i tried using get (activelayoutobject) as a condition for displaying the graphic and, as you know, it didn't work since clickinh on a tab doesn't make it "active".  is there another calculation or method you would suggest for achieving this same functionality?

                  • 7. Re: Get ( ActiveLayoutObjectName )
                    philmodjunk

                    You can use the OnObjectModify trigger to perfom a script when a tab in the tab control is clicked.

                    You can give each tab its own object name as described earlier in this thread.

                    Then your script can use this type of step to determine which tab was clicked:

                    GetLayoutObjectAttribute("TabObjectName","isFrontTabPanel")

                    • 8. Re: Get ( ActiveLayoutObjectName )
                      johnhorner

                      thanks philmodjunk... but i am still a little confused.  i couldn't find "getlayoutobjectattribute" anywhere.  is that a function or a script step or something else?  i tried to set up an onobjectmodify script trigger for each tab but the whole tab panel set only seems to accept one such trigger for the whole tab panel (not each individual tab).  i was going to try to pass the tab name as a parameter to the script but it doesnt appear that i can do that.  could you explain in a little more detail how i would go about implementing your method?

                      • 9. Re: Get ( ActiveLayoutObjectName )
                        philmodjunk

                        Did you look for it in FileMaker help?

                        It's a function. You could use it in a script like this:

                        If [GetLayoutObjectAttribute("TabObjectName","isFrontTabPanel") ]

                        To see if "TabObjectName" is the front tab panel of the tab control.

                        • 10. Re: Get ( ActiveLayoutObjectName )
                          johnhorner

                          sorry about that... first i went into the specify calculation dialog and filtered by "get" functions (where it doesn't appear) and then i must have entered a typo into the search field in the filemaker help... i'll be a little more persistent next time in my investigation!  thanks for the help.... that does the trick!

                          • 11. Re: Get ( ActiveLayoutObjectName )
                            philmodjunk

                            Yeah, well it's not a get function--which is why you didn't see it there. Get functions are only those functions named exactly "Get" but each then uses a different parameter inside the parenthesis in order to return a different value.