WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Mousemove & left button problem in Mozilla, Guilherme Blanco, May 24, 2004

Subject: Mousemove & left button problem in Mozilla From: Guilherme Blanco Date: May 24, 2004
I'm having problems with Mozilla and a "drag" event.
I create an abstract layer to manipulate events though the page in JavaScript.

But, while I left click and hold it and start to mousemove the cursor though the screen, I loose my evt.button property.

I do something like this:

function dcEvent( oEvent ) {
   oEvent = oEvent || window.event;
   ....
   this.button = oEvent.button || null;
   ...
}

Mozilla returns me always the value 0 (left clicked, even when I'm not clicking in it), but when I try to left click, it becomes null value.
It's very strange, because I can use all the other methods of my abstraction layer... like oEvt.getScreenX(); , etc.

Itīs working fine in IE, but in Mozilla, this source doesn't work:

document.onmousemove = function( e ) {
  var oEvt = new dcEvent(e);
  if (dcWindow.moving != null) {
    var oObj = dcWindow.moving;
    if (oEvt.getButton() == dcMouseEvent.LEFT)
      oObj.setLocation(oEvt.getPageX(), oEvt.getPageY());
    else oObj.stopMove(); 
  }
}

the getPageX and getPageY methods calculates the position in the screen of the browser.

My problem is here: oEvt.getButton() == dcMouseEvent.LEFT
Mozilla parses it as 0, always... so, the window layer doesn't stop moving, when I put the cursor out of the screen and put it back inside the document space. It's parsed as 0 in Mozilla, ever! So, when I'm not clicking, it has 0 value too, and continue the moving of my dynamic window.

Anyone have an idea that how can I hack it and build the same behavior that I get in IE (that if you unclick the left button, is stop dragging the window)???


Thanks in advance,
Guilherme Blanco



Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX