Sign in to follow this  
indigox3

[.net] mouse event handling

Recommended Posts

Hi Anyone know how to "clear" pending mouse up/down/move events in C#? Basically I've got a custom control with some mouse handlers. I have a button on the same form which pops up a file dialog. Most of my custom control gets covered by the file dialog when it opens up. When I double click a file to pick, the dialog goes away as it should, but the click also triggers the mouse move and mouse up handlers of my control. I suspect this happens because the mouse events are getting queued somewhere... Anyone run into this before? Thanks

Share this post


Link to post
Share on other sites
nm, I figured it out..
the file dialog goes away on the mouse down. Once its gone, the mouse up event will be over the control. A quick and dirty fix is just to use a global var like:

mousedownhandler(){
isMouseDown = true;

...
}

mouseuphandler(){
if(!isMouseDown)
return;

isMouseDown = false;

...
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this