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.)
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.
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.
I seem to remember something like this not too long ago :)
OK, thank you.
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?
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:
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?
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.
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!
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.