6 Replies Latest reply on Feb 12, 2013 9:47 AM by philmodjunk

    Filemaker AcceptButton?

    jfalberg

      Title

      Filemaker AcceptButton?

      Post

           I know in a .net form I can indicate which button on the form perform like it was clicked on if I pressed the enter key.  Does Filemaker have an equivalent for that when I'm within a specific tab section.  I would like <enter> to perform the equivalent of my "Search" button without manually moving mouse to click on button or have user to keep tabbing to that button.  Please advise, thanks.

        • 1. Re: Filemaker AcceptButton?
          philmodjunk

               Only within a Show Custom Dialog is that a built in feature.

               There are two ways to do this if you "build your own" setup for a default button:

               If you pause a script, pressing the enter key can resume the paused script. If the script steps after the pause are what you want if the user were to click the "default" button on your layout, you'll get the same results either way. This method affects a lot of areas on your layout so it probably can't be made to work for your particular layout design, but when it can be made to work, it's the simplest way to set this up.

               You can use the OnLayoutKeystroke script trigger with Code ( Get ( TriggerKeystroke ) ) = 10 to detect when the enter key has been pressed on your layout. The key trick here will be to build enough intelligence into your script so that you get the correct result in every possible situation with your layout as pressing the enter key can do a number of different things so your script may need to determine which tab panel is in front and whether the focus is in a field or not and whether or not you are in browse mode.

          • 2. Re: Filemaker AcceptButton?
            jfalberg

                 So essentially what I want to do when the enter key is triggered within one tabcontrol object is trigger a script like the button would, so hopefully that will work.  I'll need to find examples of it now.

                 I will need to determine if a tab object is active (name = TabSearch in this case).

                 maybe like this?...

                 If [GetLayoutObjectAttribute("TabSearch"; "isFrontTabPanel") or GetLayoutObjectAttribute("TabMDTSearch"; "isFrontPanel")]
                  (check for enter key pressed)
                 End If

                 edit: I suppose OnObjectKeystroke would help narrow things down here to limit to the "TabSearch" and "TabMDTSearch" objects?

            • 3. Re: Filemaker AcceptButton?
              philmodjunk

                   That's the method that I would use in FileMaker 11 or older.

                   In FileMaker 12, I'd use the new tab control script triggers to set the object name of the current tab panel to a global variable so that I don't have to use a list of If-Else IF clauses to detect which tab panel is in front.

                   Either way requires using the Inspector to give each tab panel an object name.

              • 4. Re: Filemaker AcceptButton?
                jfalberg

                     Hopefully we'll upgrade to FileMaker 12 soon once management approves.  I tried the OnObjectKeystroke method within "TabSearch" and "TabMDTSearch" but it didn't seem to work as I suppose I should use the OnLayoutKeystroke method for now.

                • 5. Re: Filemaker AcceptButton?
                  jfalberg

                       One thing I do notice when i may be in desired tab is I notice the following doesn't seem to capture the enter key:

                       if [Code (Get ( TriggerKeystroke )) = 10]

                       even when tab is true and pressing the enter key in the form input, so I wonder if there's a different line of coding I should use instead to guarantee capture of the enter key when tab is active.

                  • 6. Re: Filemaker AcceptButton?
                    philmodjunk

                         Get ( TriggerKeystroke ) probably won't return a value unless it is in a script with one of the "keystroke" script triggers.

                         There are also two keys on your keyboard that may be labeled "Enter". Thought they may have the same label, they enter different characters when pressed. 10 is the code for the enter key that is part of the numeric keypad. Use 13 to detect that the "enter" key (labeled "Return" on Mac keyboards) that is part of the QWERTY part of your keyboard.