3 Replies Latest reply on Oct 29, 2015 3:18 PM by lijnbach

    Store "ObjectName" for later use

    lijnbach

      Hello everybody,

       

      I have a lot of "buttons" that perform an action. (script)

      It would be nice if I can use the "button name" (ObjectName) in a variable for use in other scripts.

      Using Get (ActiveLayOutObjectName) doesn't work, because pushing a button doesn't meen that the button has the focus. (The button doesn't have to be active to push it).

       

      I know I can use Get (ScriptParameter) for each button if I perform a script with, but it would spare a lot of work if I can directly use the "object name" of the button that is pushed. (And store in it in a variable).

       

      Anyone a good idea?

       

      Thanks in advance,

       

      Hans Lijnbach.

        • 1. Re: Store "ObjectName" for later use
          Extensitech

          I've run into this, too. There's currently not a function for getting the object name of the button clicked.

           

          An alternative I've used, though, is to have the "button" actually be a field with an onObjectEnter trigger. Since the user has clicked into the field, that field is now the "active" object, and you can get it's name, then leave the field. If you have a background image fill on the field, the difference visually is pretty negligible.

           

          HTH

           

          Chris Cain

          Extensitech

          • 2. Re: Store "ObjectName" for later use
            Menno

            To be honest I think it would make things harder, what would the function "Get ( ActiveLayoutObjectName )" parse as result if the button-objectname now is the activating object? How do you determine which object is active at the time the button is clicked? I prefer to use the scriptparameter to parse an array of parameters, including a name for the function i wish to call with the button.

            • 3. Re: Store "ObjectName" for later use
              lijnbach

              Thanks both for your effort and time.

               

              I am using the new "menu bars" from FMPA 14. (Works great).

               

              For Chris:

              So, the option to use a field that acts like a button won't work in this case. (Not when using the menu bars).

               

              For Menno

              If you click a button, the button always does what it has to do (e.g. run a script), even when the button is not active. If a certain field is active, and you click a button, the button performs it's script, but the field stays active. So if you use Get (ActiveLayOutObjectName) you get as result the name of the active field (or active other button), but not the button you clicked on.

               

              So, I will use Scriptparameters, a little more work, but no disaster.

               

              Thanks again,

               

              Hans Lijnbach