Results 1 to 5 of 5
  1.    #1  
    I've been trying to figure this out for 2 DAYS NOW!

    If I have a textbox and a listen event for whenever a user presses a key, the enter key will never register! All the other keys do BUT the enter key. >_>! How am I suppose to go about detecting an enter key press in JavaScript??!?!!? Btw this is for the Opregle app.
  2. #2  
    Try turning off the phone, taking out the battery, and turning it back on. My keyboard stopped responding and that fixed it for me. I'm not sure if you have the same problem, but it can't hurt to try
  3.    #3  
    err, no. It doesn't trigger the event in JavaScript, in the emulator or phone...
  4. ghoti's Avatar
    Posts
    50 Posts
    Global Posts
    51 Global Posts
    #4  
    This is what I'm using, in the activate function of the scene's assistant:
    Code:
    this.onKeyDownHandler = this.onKeyDown.bind(this);
    Mojo.Event.listen(this.controller.document, 'keydown', this.onKeyDownHandler, true);
    The onKeyDown function is:
    Code:
    MySceneAssistant.prototype.onKeyDown = function(event) {
      if (Mojo.Char.isEnterKey(event.keyCode)) {
        this.FunctionToCall(event);
      }
    }
    You've also got to set changeOnKeyPress: true in the TextField attributes, otherwise you'd have to switch focus from it for the model to update.
    gh as in laugh, o as in women, ti as in nation
    DnD 4e Compendium (Beta)
  5.    #5  
    Oh my god, ghoti, you are the best! Thank you SOOO much!

Posting Permissions