PDA

View Full Version : With the doubletap, will tap always be called, or is that a bug?



rdougan
8 Jun 2010, 3:16 AM
Just a bit annoying, really.

TommyMaintz
8 Jun 2010, 10:30 AM
Tap will always be called. The alternative would be to have the tap event fired after a delay which would be more of a bug. In the meantime there are plenty ways to work around it.

jay@moduscreate.com
9 Jun 2010, 8:02 AM
Seems that this is the exact same paradigm as "click" and "double click", which developers have managed for many years now.

tobinharris
26 Jul 2010, 2:07 PM
This should help. Add to your Container/Component or whatever...



setupEventHandlers: function(){
this.mon(this.el, {
tap: function(e){
if(this.delayedTask == null){
//setup a delayed task that is called IF double click is not later detected
this.delayedTask = new Ext.util.DelayedTask(
function(){
this.doSomethingInteresting();
this.delayedTask = null;
}, this);

//once setup, need to start the clock (with reasonable time to cancel)
this.delayedTask.delay(300);
}
},
doubletap: function(e){
//Cancel and clear the delayed Task if it's there
//It would be set by the first single tap, but don't need it now we're on a double.
if(this.delayedTask != null){
this.delayedTask.cancel();
this.delayedTask = null;
}

//handle the double click as usual
this.doSomethingReallyInteresting();
},
scope: this
});
},

nosarious
6 Aug 2010, 9:55 PM
All of the examples have 'event handlers' and 'listeners'. Could someone please indicate where I could put this?

uhm... politely? I know the most logical answer to that question.