Results 1 to 5 of 5

Thread: Add keyup event to body?

  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    628
    Vote Rating
    40
      0  

    Default Add keyup event to body?

    In Ext JS you can add DOM element events using component.mon(). I don't see mon() is the Touch API. What I want to do is listen for ctrl-L key event on the body. Is this possible using the Touch API? I believe I can do this using straight JavaScript but always prefer using the API over that.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    You only need on() on an element or component now, not mon(). The issue is ST is geared towards mobile devices which don't have a keyboard open unless on a form field.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    628
    Vote Rating
    40
      0  

    Default

    This is actually a Kiosk project that runs in Chrome. We want a ctrl-L from a real keyboard to bring up a console in the app to help troubleshoot devices. I'll see if I can get something to work.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Then that will require just native JS
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    628
    Vote Rating
    40
      1  

    Default

    Ended up being easy. Though scope would be a pain but wasn't.

    Code:
            var me = this,
                body = Ext.getBody();
    
    
            body.dom.addEventListener('keyup', function(event) {
                me.onKeyup(event);
            }, true);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •