PDA

View Full Version : [FIXED-154] stopEvent does not work



dayext
21 Jul 2010, 4:53 AM
Hi,
trying to stop a doubletap event with Event#stopEvent, which is supposed to cancel the event. On an iPad, this should block the zoom.
Uncommenting lines 616 and 617 of the TouchEventManager#fireEvents method fixes the issue. But there is certainly a reason why these 2 lines are commented.

sencha-touch v 0.9.1



fireListeners : function(ename, track, e) {
var me = CQ.Ext.TouchEventManager;

e.type = ename;
e.target = track.target;
e.touch = track.touch;
e.identifier = track.touch.identifier;

var targets = track.events[ename],
target, listeners, listener,
id, i, ln;

if (targets) {
for (id in targets) {
listeners = targets[id];
for (i = 0, ln = listeners.length; i < ln; i++) {
listener = listeners[i];
if (listener.call(CQ.Ext.getDom(id), e) === false || e.cancel === true) {
if (e.browserEvent) {
//UNCOMMENT 2 FOLLOWING LINES
//e.browserEvent.stopPropagation();
//e.browserEvent.preventDefault();
}
return false;
}
}
}
}

return true;
},


Regards,
alexc

Jamie Avins
21 Jul 2010, 8:58 AM
You issue has been entered in Trac for review.

TommyMaintz
28 Jul 2010, 3:36 PM
There was really no reason why those two lines were commented out. ;) I did that to test some Android touch bugs and somehow the change managed to get to the master branch and into the release.

This will be fixed in the next release (0.9.3) due beginning of next week.

hejp
25 Apr 2011, 10:11 PM
Hi,
In Android, I tried to stop event, but it doesn't work.(it went into the method, but it didn't stop the event)


onMyKeyup: function(fld, e) {
if (e.browserEvent.keyCode == 13) {
fld.fieldEl.dom.blur();
e.stopEvent();
}
}


What's the right code?

Bucs
26 Apr 2011, 6:55 AM
I am having all kinds of issue with Android support, to which I am about to create a new thread. But @hejp, I currently am having a problem with listening to a keyup event on Android...where did you find the onMyKeyup event, and does that work...i.e. is that firing the function? Obviously, I will probably also have the same issue with the stop event, which will need to be resolved as well, but hey, it's a start :)

hejp
29 Apr 2011, 5:23 PM
Hi Bucs:
onMykeyup event code:


items : [{
xtype : 'textfield',
name : 'city',
label : 'From',
listeners: {
keyup: this.onMykeyup,
scope: this
}
}, {
layout : 'vbox',
defaults : {
xtype : 'button',
flex : 1,
style : 'margin: .5em;'
},
items : [{
text : 'Submit',
scope : this,
hasDisabled : false,
handler : this.onMySubmit
}]
}]

...

onMyKeyup: function(fld, e) {
if (e.browserEvent.keyCode == 13) {
fld.fieldEl.dom.blur();
e.stopEvent();
}
}


Note: Now it works. The reason I had find. The submit button(if you write handler : onMySubmit, OK; and if you wirte handler : onSubmit, Wrong), so the event name is not go-as-you-please. UnderStand? Forgive my English.

hejp
29 Apr 2011, 5:32 PM
Hi Bucs:
do you met this problem, It confuse me for a long time, and I have not resolve it yet.
http://www.sencha.com/forum/showthread.php?131208-BUG-Disabled-Textarea-Still-Popup-Soft-Keyboard-In-Android&p=594384#post594384.
If you find the answer, tell me. I will really appreciate it. Thank you!