6 Replies Latest reply on Apr 10, 2012 9:47 PM by WillPeart

    Get (ActiveLAyoutObjectName) on a button



      Get (ActiveLAyoutObjectName) on a button


      I am trying to use this to get a button to identify itself and make its name as a variable, but the pressing of the button dosnt make it "active", yet the help file uses this very example.


      Here is my script step: Set Variable [$BinSelected; Value:Get (ActiveLayoutObjectName)]


      This button is named FitA1, so I want the press of that button to return a variable in $BinSelected as FitA1

      I then want to add a letter to this variable to Identify a field to select via set field or go to object. Eg if I added & "q" to the above Set Variable, then I am hoping to have that variable select the field named FitA1q.


      Is there another step in the calculation window?


      What am I missing?


      I am usint FM9 Pro on windows xp, and my expierence level is not that great.

        • 1. Re: Get (ActiveLAyoutObjectName) on a button

          Yeah, that one suprised me a time or two also. Clicking a button doesn't give it the focus. To put the focus on a button, it has to be part of the tab order and then you can tab into the button much like you tab into a field. Tab into the button and then click it and your script will then correctly return the name of the button. (This is an object name assigned using the object info palette--not the button's label text.)


          From a practical side, since you have to click the button to trigger the script, you can pass the button's name as a parameter to the script. (I can do that with Filemaker 10 and am pretty sure that filemaker 9 can as well.)

          • 2. Re: Get (ActiveLAyoutObjectName) on a button

            Pass in a script parameter when you specify the button in calling the script. Then you can use Get ( ScriptParameter ) to capture its value in the script.



            Also I just looked at the help. The help states:

            "When the focus is on the button,Get(ActiveLayoutObjectName) returns cancelButton"



            This means when the button has focus on it such as when you can select it by tabbing to it. This has nothing to do with clicking the button.

            • 3. Re: Get (ActiveLAyoutObjectName) on a button

              Ok, thanks chaps.


              Ill modify my storage location DB to suit. The original plan was to select a particular button to choose a location to store a job in, now ill tab to the location and create a single "store in selected location".

              • 4. Re: Get (ActiveLAyoutObjectName) on a button
                   FYI I have just managed to work out how to get the button to report its own name and get it as a variable. The first script step needs to be Goto Object (name of the button just pressed) That makes it active. Then I have the second script step as run script (as above)
                • 5. Re: Get (ActiveLAyoutObjectName) on a button

                  Since you have to name the button to go to it, wouldn't be simpler just to just use the name of the button as literal text?


                  It seems like your script is saying: go to button "xyz", Now let's see what's the name of the current button... oh yeah it's "xyz", use that text to....


                  Where it could just as easily skip the first part and you'll get the same results?


                  Mr. Vodka and I both suggested passing the button's object name as a parameter figuring you must be using the same script with different buttons.

                  • 6. Re: Get (ActiveLAyoutObjectName) on a button


                    I am having almost the exact same problem as dob85y: trying to use the object-name of a button in a script that runs when you press that button.

                    PhilModJunk, can you please clariffy when you say...

                    "Mr. Vodka and I both suggested passing the button's object name as a parameter figuring you must be using the same script with different buttons."

                    How can you set the object name as a parameter? I can only think of using Get (ActiveLAyoutObjectName) as a calulated parameter, but this raises the same problem of the button not being in focus on the layout when it is clicked.