PDA

View Full Version : Why does EventObject.stopEvent fire "mousedown"?



Animal
18 Oct 2008, 8:40 AM
It has



stopEvent : function(){
if(this.browserEvent){
if(this.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(this);
}
E.stopEvent(this.browserEvent);
}
},


I just spent a couple of hours trying to track down an infinite recursion problem that doesn't happen if you get into Firebug.

Turns out that this was the cause. A mousedown event causing an event which attempts to stop the event. But Ext's stopEvent method refires it, and so it goes in a circle.

Anyone know why it does this?

hendricd
18 Oct 2008, 8:48 AM
If that's from SVN, I think it's Brian's recent fix for a drag outside of browser boundaries. Not sure tho.

jack.slocum
18 Oct 2008, 9:18 AM
It's in there for things which MUST know about mouse down events. If you attach a mouse down listener to the body, you will always be notified, regardless if the app developer stops the event. This is how menus and other component ensure they are able to close properly.

Animal
18 Oct 2008, 1:06 PM
Oh well, I made a direct call to Ext.lib.Event.stopEvent passing the browser event eventually, and that fixed it.

peter seliger
8 Oct 2009, 1:01 AM
Hallo,

you wrote:

Oh well, I made a direct call to Ext.lib.Event.stopEvent passing the browser event eventually, and that fixed it.

Would you please explain what you have done to fix this problem?
I look for a solution and can't fix it !!!:((

Thanks

Animal
8 Oct 2009, 1:04 AM
:-/:-/:-/:-/

Made a call to Ext.lib.Event.stopEvent passing the browser event!

peter seliger
8 Oct 2009, 1:14 AM
Thanks,

could you give me a little example, to understand what you have done in details?

Animal
8 Oct 2009, 1:40 AM
I'm confused now.

An "example" of calling a function?

You just use



functionref()

peter seliger
8 Oct 2009, 1:52 AM
Sorry,

a little more about my problem:

calling a function from a menuitem to open an Ext.ux.ManagedIFrame.Panel inside an TabPanel produced
an error "access denied" in 2778 and my debugger show



stopEvent : function(){
var me = this;
if(me.browserEvent){
if(me.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(me);
}
E.stopEvent(me.browserEvent);
}
},


and stop on



if(me.browserEvent.type == 'mousedown'){


i thought your problem could be my problem!

i use Ext3.0.0

sorry for my bad english

Animal
8 Oct 2009, 1:59 AM
So this is all about "something completely different" then.

I would guess that the browser event is from the document in the iframe? If that is so, then security constraints would prevent code loaded from your domain from accessing the iframe's data.

peter seliger
16 Oct 2009, 4:57 AM
The error is coming from document who is calling then iframepanel exactly on



stopEvent : function(){
var me = this;
if(me.browserEvent){
ERROR --> if(me.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(me);
}
E.stopEvent(me.browserEvent);
}
},


:((:-/:-?~o)

Animal
16 Oct 2009, 6:28 AM
It's security. Scripts in your page cannot access objects in the iframe page. That's all.

peter seliger
18 Oct 2009, 11:24 PM
My page don't access objects in iframe page. I call my own function for place the iframepanel in a tabpanel in my page. The iframepanel is inside my page, nothing else. My own function is calling from a MenuItem and thats the problem.
Sometimes i call my own function more times and nothing happens and sometimes i call
my own function one time and the problem appear.:-/
When the problem appears the Menu with the MenuItem don't close.

Animal
18 Oct 2009, 11:31 PM
You need to post a testcase.

peter seliger
18 Oct 2009, 11:33 PM
Any idea how to do that?

peter seliger
20 Oct 2009, 5:06 AM
What should the testcase include?

peter seliger
20 Oct 2009, 6:14 AM
I have reduced my app to a minimum.
But this should be enough to demonstrate my problem.

hendricd
20 Oct 2009, 6:37 AM
@Peter -- I would theorize:

that this is on IE only?

on IE the window.event (e.browserEvent) is global, and it's possible your getting one of the IFRAME events bubbling instead.

A temporary workaround, would be to defer the MIF creation just a bit and let the menu hide itself first:



var maintoolbar_support = new Ext.menu.Item({
id: 'maintoolbar_support',
text: 'Support',
handler: function(){
dvpcontrolling.loadsupport.defer(20,dvpcontrolling);
}
});
Also, download the latest version of MIF 2.0 final. ;)

peter seliger
21 Oct 2009, 1:35 AM
Thanks a lot !:D

It's realy only on IE.
To defer executing my function helps:D.
The problem appears not so often, unless very rare.
Maybe i need to raise the delay time?
Is the argument given in millisecond?