OnMouseMove and timers conflict

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

OnMouseMove and timers conflict

Post by kexik_white »

I have conflict with menu and AJAX application.
Menu hardly replaces document.OnMouseMove and application doesn't work correctly - you can see example on http://t-mobile.cz/Web/Residential/Tari ... ytiCR.aspx - if you switch map application from rezise to move mode (by clicking Image), it doesn't work because menu "steals" event handler.
Is there any mistake in my menu definition or configuration? Or how can I solve this problem?

Second problem is that menu uses timers very agresivelly with low timeout (some of them are 10ms) that causes very slow response of my map application. Is there posibility to change values of these timers?

Thanks.
Last edited by kexik_white on Thu Sep 18, 2008 2:26 pm, edited 1 time in total.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

Hi,

Have you tried declaring the menu as the very first JavaScript object on the page. This will enable anything after the menu code to capture the document.onmousedown event.

With regards to timing, you can try changing the internal settings in the code but it may have adverse effects.

-- Andy
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

Thank you for the answer, I have tried declaring the menu as the very first JavaScript object on the page but it has no impact, problem persists :(

Does the menu use really correct way to attach event handlers?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

Hi,

If the menu has been declared first and then your code is set to capture the document.onmousedown event it will override the menus onmousedown event.

Have you tried removing the menu and seeing if the code works?

Also, try setting your own code for the onmousedown, onmouseup and onclick events and see if that helps.

-- Andy
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

Here is example with "very first menu code" - it doesn't work:
http://t-mobile.cz/Web/MapMilonicTest.html

Here is the same page, but drawMenus() is commented - every scripts are loaded, only drawMenus() function is skipped - and map application works:
http://t-mobile.cz/Web/MapMilonicTest2.html

Maybe there is variable name conflict? I cannt imagine what else can be wrong.
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

I am shure that document.onmousedown is set by the menu function called by timer - thats why it doesnt depend on script order.

I think menu code should assume that somebody other have set document.onmousedown first :(
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

I can confirm that document.onmousedown is executed only once when the menu is loaded.

This means you can override it.
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

Thank you for your reply. I will try to deactivate URL matching - but I cannt find page with global properties it seems to be missing http://milonic.com/global_properties

Is it possible to disable URL matching?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

You should just be able to remove any reference to "pagematch" within your data file. This will disable pagematching. Unless you mean something other than page matching?
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

Andy wrote:I can confirm that document.onmousedown is executed only once when the menu is loaded.

This means you can override it.
I analysed actions of menu code and found that problem is caused by incorrect setting of document.onmousedown handler.
It is set by only once but by a timer, so It happens after the handler has been set by other scripts.

I can set document.onmousedown later by a timer too but this is a dirty hack.
I would rather not modify original menu code to correct setting of onmousedown handler.

Is there way to correct the menu code by the Milonic?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

Again, I can assure you that the menu does not set a document.onmousedown event through a timer.

If you visit both pages:

http://t-mobile.cz/Web/MapMilonicTest.html
http://t-mobile.cz/Web/MapMilonicTest2.html

Then type the following into your browser address bar for each page you will see the same function (that has nothing to do with Milonic) appear in the alert box.

javascript:alert(document.onmousedown)

Code: Select all

function (e){ev(e);fce(e);}
The above is the function that has control over document.onmousedown, the menus event has been deleted.
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

I have to apologize - the problem is not with onmousedown handler but with document.onmousemove.

This is set inside $N function called by a timer and this timer is set inside function o$.

The first (affected) page has incorrect handler:

function gMY(e){if(ns6){X_=e.pageX;Y_=e.pageY}else{e=event;X_=e.clientX;Y_=e.clientY}mmMouseMove();_TtM();_IdM();doMenuResize(focusedMenu)}

The second page has different handler:

function(e){ev(e);fce(e);}
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

In that case, adding the following to your menu_data.js file will disable the menus onmousemove code:

disableMouseMove=true;

Please let me know if this helps or not.

-- Andy
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

Here is page http://t-mobile.cz/Web/MapMilonicTest.html with disableMouseMove=true;

Map application now works fine - but when the move button is clicked, the menu stops work.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: OnMouseMove and timers conflict

Post by Andy »

I don't see any problems with the menu, works fine for me in Firefox and IE6.0
kexik_white
Advanced
Advanced
Posts: 18
Joined: Thu Jun 02, 2005 10:41 am
Contact:

Re: OnMouseMove and timers conflict

Post by kexik_white »

Thank you, problem has been fixed - in IE7 was a bug in a map application.
Post Reply