Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > Re: Why do mous...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 35501 of 37133
Post > Topic >>

Re: Why do mouseup events sometimes fire if the mouse is not released?

by Stevo <no@[EMAIL PROTECTED] > May 6, 2008 at 08:51 PM

markszlazak@[EMAIL PROTECTED]
 wrote:
> In the following script, a control displays (black box) in each table
> cell once you mouse over the cell. Mouse down on the control to change
> the mode of the table. Drag the mouse over cells in the same column
> then mouseup anywhere in a cell. The mouseup event sometimres fires
> before the selection of table cells by dragging is complete. It's
> im****tant that I stop these "false" mouseup's from firing or
> distinguish them from when I let go of the mouse button.

You might be suffering from key bounce. It happens with switches all the 
time. You push a button and think you're making contact once and keeping 
the button down you'd expect no mouse up. But, the nature of switches is 
that you often get a bounce like a dropped ball doesn't just hit the 
ground and stay there, it bounces a few times before settling. Same deal 
with switches. I had to build debounce logic into a keyboard driver I 
wrote once, although that was in assembler and had a lot more control 
over timing than JavaScript would have. The basic principle is that you 
ignore up events for a certain amount of time because you know they're 
just the bounces. Then after that "blocking" time (we're talking a very 
short time here), you look at the state, wait a bit more, check it 
again, and then you can be sure of the final state and re-enable 
(unblock) the up events. If you see the state is up, then you can 
generate an up event (or call your up event handler) because you've 
detected a genuine up event.

Now whether all this is coming into play in your situation, and whether 
even if it is, you have the level of control that would be needed is a 
different story. It's possible of course that Windows already takes care 
of such issues. I'm throwing it out there though, and it was fun to 
reminisce about the old days of Assembler to myself :-)
 




 3 Posts in Topic:
Why do mouseup events sometimes fire if the mouse is not release
markszlazak@[EMAIL PROTEC  2008-05-06 11:27:45 
Re: Why do mouseup events sometimes fire if the mouse is not rel
Stevo <no@[EMAIL PROTE  2008-05-06 20:51:56 
Re: Why do mouseup events sometimes fire if the mouse is not
markszlazak@[EMAIL PROTEC  2008-05-06 19:32:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 5:56:32 CDT 2008.