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
    631
    Vote Rating
    41
      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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      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
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    631
    Vote Rating
    41
      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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    Then that will require just native JS
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    631
    Vote Rating
    41
      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
  •