Sencha Touch Label - is there a Tap event?

I'm trying to create an application for flash cards with sencha touch 2. I have a shortcut that displays a question that takes up the whole screen, I want it to show the answer when the user clicks on the label. Does the tag have a label? It works when I use a button, but not when I use a label.

Another way is to make the button transparent over the label. Any suggestions?

+6
source share
3 answers

You can do it:

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

Hope this helps

+4
source

Another way to bind a tap event to a label control using sencha touch.

 { xtype : 'label', html : 'my name is abc', listeners : { element : 'element', tap : function(e, t) { alert('1 pressed'); } } } 
+2
source

Ext.Label not intended for the tap event. However, you can still achieve this through the tap event on the HTML element of the label, for example:

label.getContentEl().on{'tap', handler_function,this}

But Sencha Touch does not provide a tap event on Ext.Label , which is a child of Ext.Component , so when you try to use the tap event on a shortcut, this is not the best practice.

The best approach is to use Ext.Button with the following 2 configurations:

 { ui: 'plain', cls: 'btnCls', } 

and in your CSS, make your background transparent.

+1
source

Source: https://habr.com/ru/post/916281/


All Articles