In layout mode you can give each layout object you want to use its own name, via the Inspector's Position panel (top item: name).
Then you can pass the same variable to the script as a calculation: Get ( ActiveLayoutObjectName )
You still have to pass this script parameter, but you don't have to make it different each time if the object which is the button has been Named.
My problem is that when I push a button (which is the field label...) named (into the Inspector's Position panel) for example "Surname", this name is not catched by the Get ( ActiveLayoutObjectName ) that you mentioned...
How can I set this button as the active object in the moment that I push it?
Mea Culpa -- you're correct that just pushing th button fails to make it the active object. I found if it was in the tab order and "selected" when pushed, then it returned the correct info the the script, but pushing it when it's not yet selected fails to pass the calc result.
Starts to look like you need to set the parameter differently at each button level, as you had been doing.
Sorry, but I cannot identify any existing Get(function) which will pass the button/object name if it is not previously selected.
Thank you Stephen anyway.
But, for your experience, isn't there any other command able to select a button when you push it, letting it become the active object just before the Get ( ActiveLayoutObjectName ) command starts?
Isn't there any way to use for example the OnObjectKeystroke?
I don't believe that will work either.
On the other hand, assigning a separate script variable at each button is really no different amount of work than is assigning a unique name to each object you intend to use as a button.