PDA

View Full Version : Fire an event on tap and hold?



crosslink06
8 Sep 2011, 6:10 PM
Hi all,

ItemTap and ItemDoubleTap events works good on my list items. What I am looking for to do is simply to fire the event when an item is tapped and hold (pressed 100ms).
Do you guys have any idea/example about how I can do that please? I didn't find any help on the forum/API doc.

Thank you

mitchellsimoens
9 Sep 2011, 5:29 AM
Just a sample:


panel.mon(panel.el, {
taphold: function(e, t) {}
});

crosslink06
9 Sep 2011, 4:26 PM
Thanks Mitchellsimoens,

This way works on a panel but not in my list which is included within a panel...
The only way I've found to make it works is the following:

views.News = new Ext.List({
xtype: 'list',
store: views.ListStore,
itemTpl: '<div class="category">{DisplayName}</div>',
filterOnLoad: true,
onItemDisclosure: true,
listeners: {
el: {
taphold: showActionSheet
}
}

var showActionSheet = function (record, btn, index) {

var store = views.ListStore;
record = store.getAt(btn);
var getrecord = record.get('DivisionId');

var textItem;
var uiItem;

if (getrecord == '9') {
textItem = "Publish";
uiItem = "confirm";
}
else {
textItem = "Unpublish";
uiItem = "normal";
}

views.Actions = new Ext.ActionSheet({
items: [
{
text: textItem,
ui: uiItem,
handler: views.ActionToPublishOrUnpublish
},
{
text: 'Delete',
ui: 'decline',
handler: Ext.emptyFn
},
{
text: 'Cancel',
scope: this,
handler: function () {
views.Actions.hide();
}
}]
});

views.Actions.show();
}

However, the taphold event happens too early so the showActionSheet function parameters are null.
This is a problem that i don't meet with a tap a double tap event.

Do you have any tricks about how to fix it?
Thank you,

crosslink06
16 Sep 2011, 2:24 PM
nobody?

landed
21 Mar 2012, 2:05 AM
I have noticed the taphold only fires once as well. Would be very nice to repeat the event every X. I suppose the way to do this is look out for the release and until that happens keep doing the event.

Or am I missing something.

anilvardhan.p
11 Mar 2014, 7:53 PM
Hi Mitchellsimoens,

How to implement taphold release in sencha touch 2, can you please help me