Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha Touch Label - does it have a Tap Event?

I'm trying to build a flashcard app with sencha touch 2. I have a label showing the question, which takes up the entire screen, I want it so that when the user taps on the label the answer shows. Does the label have a 'tap' event? It works when I use a button, but not when I use a label.

Another way around is if I can get the button to be transparent on top of a label. Any suggestions?

like image 351
James Gu Avatar asked May 21 '12 15:05

James Gu


2 Answers

You can do this :

label.element.on({
    tap : function(e, t) { ... }
});

Hope this helps

like image 193
Titouan de Bailleul Avatar answered Oct 13 '22 03:10

Titouan de Bailleul


one more way to bind the tap event to the 'label' control using sencha touch.

{
    xtype : 'label',
    html : 'my name is abc',
    listeners : 
    {
        element : 'element',
        tap : function(e, t) 
         {
           alert('1 pressed');
         }
    }
}
like image 34
vipin katiyar Avatar answered Oct 13 '22 03:10

vipin katiyar