Results 1 to 8 of 8

Thread: [2008] How to Ignore a Click Event?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2008
    Posts
    150

    [2008] How to Ignore a Click Event?

    Hey all,

    I'm developing a touchscreen application, and today's task is to make a custom slider control made up of a panel and a picturebox who's parent is said panel.

    The picturebox is moved up and down the panel based on the cursor location during the .MouseMove event. That part, works a treat. Problem is, if the panel is clicked (which can happen inadvertently with a touchscreen), the picturebox will slide down to the cursor's location, then snap back to it's original location and do this over and over...giving quite an ugly affect.

    I can't see how my code makes it slide and go back repeatedly, so I was thinking the easiest way out is to ignore the click event.

    Any ideas? I have attached the project so you see exactly what I mean

    Cheers,
    Scott
    Attached Files Attached Files

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: [2008] How to Ignore a Click Event?

    It's not responding to the click. It's responding to the MouseMove.

  3. #3
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: [2008] How to Ignore a Click Event?

    Try something like checking for the last Mouse location. If it moves more than x amount then disregard the move.

  4. #4
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: [2008] How to Ignore a Click Event?

    "It's not responding to the click. It's responding to the MouseMove."

    That wasn't very clear was it?
    What I mean is that when the screen is touched in another location, the mouse has now moved. Therefore, a click = a mouse move.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2008
    Posts
    150

    Re: [2008] How to Ignore a Click Event?

    Quote Originally Posted by FourBlades
    "It's not responding to the click. It's responding to the MouseMove."

    That wasn't very clear was it?
    What I mean is that when the screen is touched in another location, the mouse has now moved. Therefore, a click = a mouse move.
    I don't quite understand what you're suggesting this this last comment.

    It's actually quite hard to get this to occur and it only happens on the odd occasion. I still feel you need to have it ignore (or not actually change the location of the picturebox) if the mouseclick/mousedown is detected - because I can actually get it to scroll with the mouse button pressed. I played with the 'MouseButtons.None' thingy but didn't get any love there.

    I'll have more of play once I have it running on the touchscreen itself and see if I can even get it to happen - may not have to worry about it.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2008
    Posts
    150

    Re: [2008] How to Ignore a Click Event?

    I think it's also worth pointing out that it's impossible (AFAIK) to click on the panel without causing a MouseMove event. The issue is that you can do a Click and a MouseMove simultaneously. So again, want to find a way to ignore the "move" if that move is a 'click' as opposed to just a cursor movement. Surely it's easy, just gotta find the right decombobulator!

  7. #7

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2008
    Posts
    150

    Re: [2008] How to Ignore a Click Event?

    Quote Originally Posted by Deepak Sakpal
    What if you slide the picture box in MouseDown event.
    Thanks for the suggestion Deepak.

    If it were a normal application that may be a nice solution, however for this particular situation, the user is merely swiping their finger up or down the touchscreen. Unfortunately if I used the MouseDown event, you would lose the ability to slide the picturebox when the mouse was not down.

    To click on a touchscreen (at least my touchscreens), you must tap the screen quite sharply, and to 'click and drag' takes quite a bit of pressure, takes that initial sharp tap and a firm drag. You can however move the mouse very easily by a gentle finger movement, which is why I have chosen to use MouseMove event.

    Any other ideas? Maybe someone knows how to tell if the mousebutton is down while I'm in the MouseMove event, I reckon it'd solve my issue (however I am happy to be proven wrong!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width