Results 1 to 3 of 3
  1.    #1  
    What am I doing wrong?

    Code:
    this.controller.listen( window, Mojo.Event.keypress, function(event) { Mojo.Log.error( "keypress" ); } );
    It never calls this. I can capture a key down and a key up but press doesn't fire!
  2. #2  
    This works for me. The actual handler is pre-cached in the initialize method

    Code:
    this.onKeyPressHandler = this.onKeyPress.bind(this);
    Then the following in the activate.

    Code:
    Mojo.Event.listen(this.controller.document, "keypress", this.onKeyPressHandler, true);
    This method works in both a scene and stage assistant.
  3.    #3  
    Quote Originally Posted by Blubble View Post
    This works for me. The actual handler is pre-cached in the initialize method

    Code:
    this.onKeyPressHandler = this.onKeyPress.bind(this);
    Then the following in the activate.

    Code:
    Mojo.Event.listen(this.controller.document, "keypress", this.onKeyPressHandler, true);
    This method works in both a scene and stage assistant.
    Yes, what I discovered is this:

    1. You cannot capture keypress on window (this is NOT to spec)
    2. While you (oddly) can capture keydown/up on window, if you do so, then keypress on document no longer works

    So to get it to work, you have to capture keypress, down and up all on document.

    Weird.

    Thanks for the help!

Posting Permissions