4 Replies Latest reply on Mar 4, 2009 9:43 AM by bsternberg

    Using OnLayoutKeystroke in FileMaker 10

    bsternberg

      Title

      Using OnLayoutKeystroke in FileMaker 10

      Post

      I would like to create layout specific keyboard shortcuts using OnLayoutKeystroke in FileMaker 10. I already have custom menus with some shortcuts, but I don't want to be adding new commands to the menus for different layouts. I've checked out the help file, but I'm a little confused. Could anyone give me a simple example to help me along? Thanks! 

        • 1. Re: Using OnLayoutKeystroke in FileMaker 10
          davidhead
             It would probably be easiest if YOU gave some examples of what you are trying to do. I am a bit confused by your post.
          • 2. Re: Using OnLayoutKeystroke in FileMaker 10
            bsternberg
              
            II am designing an invoicing/inventory/purchasing system for my business and many of the layouts have buttons for various scripts. Some of the buttons will have corresponding custom menu items, so keyboard shortcuts for those are straightforward. Buttons with shortcuts will have an underlined letter so that users will know what the shortcut would be. Most of the standard FileMaker keyboard shortcuts will be disabled because the solution will be using custom menus throughout.

            I would rather not create a custom menu item for every single button throughout the solution for the purpose of creating a keyboard shortcut. My question is can I use OnLayoutKeystroke to create a keyboard shortcut which would trigger a script on specific layouts? And if so, could you show me a simple example to get me started 

            I hope this clears up my question! Sorry for the confusion.
            • 3. Re: Using OnLayoutKeystroke in FileMaker 10
              davidhead
                

              Sorry for the delayed response.

               

              In short, you cannot use OnLayoutKeystroke to create traditional shortcuts that use the apple or control key. Potentially, you could use a letter alone to trigger a script. For example, you could use a script like this:

               

              If [ IsEmpty ( Get ( ActiveFieldName ) ) // there is no active field ]

               If [ Get ( TriggerKeystroke ) = "a" ]

                Show All Records

               ElseIf [ Get ( TriggerKeystroke ) = "f" ]

                Enter Find Mode [ ]

               ElseIf [ Get ( TriggerKeystroke ) = "n" ]

                New Record/Request

               EndIf

              Exit Script [0]

              EndIf 

               

              That would allow the user to type any of the keys to run the commands when a field is not active.

              The initial test is to ensure that the user is not trying to type into a field.

              The Exit Script with false is needed to cancel the trigger event (typing the character).

               

              I have not fully tested this to see what other effects it might have. But it might be what you are looking for?

              • 4. Re: Using OnLayoutKeystroke in FileMaker 10
                bsternberg
                   Thanks for the reply. I'm not sure if I will use this function in my application, but I certainly will experiment to get a better understanding of how it works. You've given me a good starting point - thanks again!