Results 1 to 6 of 6

Thread: Tap event question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Belgium
    Posts
    4
    Vote Rating
    0
      0  

    Question Answered: Tap event question

    Hello,

    I'm trying to listen to a tap event but I can't get it working. Here's how my app.js file looks like:

    Code:
    var panel = Ext.create('Ext.Panel', {
        style: 'background-color: green;',
        listeners: {
            show: function() {
                alert('hello');
            }
        }
    });
    
    
    panel.addListener({
        body: {
            tap: function() {alert('tap');}
        },
        scope: this
    });
    
    
    //panel.addListener('tap', 
    //    function() {alert('tap');},
    //    this,
    //    {element: 'body'}    
    //);
    
    
    Ext.application({
        name: 'Test App',
        
        launch: function() {        
            Ext.Viewport.add(panel);
        }
    });
    The 'show' event works, but the 'tap' event doesn't. Could someone please help me?
    Thank you!

  2. Your first code block is not working because you are creating a panel (which does NOT mean it is rendered), then adding it to the viewport (which does mean it is rendered). You should add it to the viewport, then add the listener. This should work.

Tags for this Thread

Posting Permissions

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