2 Replies Latest reply on May 6, 2014 5:32 AM by philmodjunk

    Field with button - enter the object in find mode

    robdownunder

      Title

      Field with button - enter the object in find mode

      Post

           Ok, FM12.

           I have fields throughout my database that have a button associated with them to run a specific script.

           Multiple field and multiple layouts use this button, so the solution needs to be dynamic.

           When I enter Find mode I cannot type in a search term - the script is run even though I don't want it to.

           Using   if Get(WindowMode)  = 1       at the start of the script, I can determine that I am in Find mode.

           I'm stumped on how to tell the script to then put the active cursor into the field to allow me to type a search term.

           The field I want to search on is not the active object, the first field on the layout is.

           I can keyboard-tab my way through the fields to select the one I want.

           How can my script figure out which object I pointed to and make it active ?

            

           Thanks for any solutions you can come up with.

            

        • 1. Re: Field with button - enter the object in find mode
          Jade

               G'Day Rob,

               Assign a different object name (Position tab of Inspector) to each of these fields.

               For each button, specify the object name as a script parameter (bottom of the Specify Script dialog).

               At the top of your script, change the If statement to:

               If [ Get( WIndowMode ) ≠ 1 ]

               At the bottom of the script just before the last End If, add:

               Else

                  Go To Object [ Get( ScriptParameter ) ]

                

          • 2. Re: Field with button - enter the object in find mode
            philmodjunk

                 Instead of associating a button with these fields, you might instead use script triggers to produce the same result. That might, in many circumstances, eliminate the need for using a script to put the cursor into the field when in Find Mode.