3 Replies Latest reply on Jun 19, 2012 3:11 PM by philmodjunk

    TriggerKeystroke Bug

      Summary

      TriggerKeystroke Bug

      Product

      FileMaker Pro

      Version

      FileMaker Pro Advanced 11.0v3

      Operating system version

      Windows 7

      Description of the issue

      Hello Support:

      OnObjectKeystroke trigger can lead to an infinite loop under the conditions given below.

      Steps to reproduce the problem

      1. Create a portal (or any object, really)
      2. Give the object an object name
      3. Specify an OnObjectKeystroke script (be sure Allow User Abort is set to "On")
      4. In the script specified, issue the Go to Object script step and return to the object named in step #2 above (in other words, return to the very object that raised the trigger in the first place)
      5. Notice that the script is now in an infinite loop

      Expected result

      It would seem that the keyboard buffer isn't flushed after the Get(TriggerKeystroke) function is called.  When returning to the object under script control, FileMaker sees a keystroke in the buffer and repeatedly fires the OnObjectKeystroke event.

      This is a real problem when trying to implement keyboard-based navigation for portals.  After processing, say, the Home key or the Up key, it is necessary to return to the portal and await the user's next keystroke.  Because of this bug, it is not possible to implement keyboard-based navigation.

      Actual result

      OnObjectKeystroke can lead to an infinite loop.

      FileMaker should immediately flush the keyboard buffer after calling Get(TriggerKeystroke).  If the developer wants to persist the keycode for processing in the rest of the script, he should do the following:

      Set Variable[$keycode; Code(Get(TriggerKeystroke))

      Exact text of any error message(s) that appear

      N/A

      Configuration information

      N/A

      Workaround

      None.

        • 1. Re: TriggerKeystroke Bug
          philmodjunk

          Here's a workaround you can use:

          If [Not $$TriggersOff]
             Set Variable [$$TriggersOff ; value: True]

             Put your current script here

             Set Variable [$$TriggersOff ; Value ; false]
          End IF

          This is a method you can use in any situation where you need to keep a trigger controlled script from tripping its own trigger.

          • 2. Re: TriggerKeystroke Bug

            Thank you for your response.

            Unfortunately, this is not the problem.  I'm aware of the technique you describe.  The problem isn't that my trigger-controller script is triggering itself.  It's simply that I return to the object that triggered the script by issuing the Go to Object[] script step.

            Going to an object is not the same thing as pressing a key, so there should be no reason for FileMaker to infinitely trigger the OnObjectKeystroke trigger.

            Your proposed solution does not work.

            This is definitely a bug.

            Again, thank you.

            • 3. Re: TriggerKeystroke Bug
              philmodjunk

              I cannot reproduce the bug.

              Using Windows XP, I created a one line script:

              Go to Object ["field1"]

              I gave a field on the layout "field1" as its object name.

              Set up field1 with the OnObjectkeystroke trigger

              Watched trigger perform script in script debugger and also tested with debugger not active.

              No infinite loop occurred.