Click and hold/drag
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Click and hold/drag

  1. #1
    Join Date
    Feb 2011
    Posts
    47

    Click and hold/drag

    Hey everyone.
    So i have a grid in my program that i want the user to be able to click and drag items around.
    Im using the CALLBACK WindowProc to handle my mouseclicks at the moment, but that can only handle a click at one location (as far as i can work out). Is there an easy way to simulate click and hold and click and dragging? Maybe a way to constantly keep getting the mouse location that i dont know of?
    Thanks,
    M

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,016

    Re: Click and hold/drag

    Handle WM_MOUSEMOVE.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    Feb 2011
    Posts
    47

    Re: Click and hold/drag

    Thanks for your reply, sorry its taken me so long to get back to you on this.

    Im kinda rubbish with c++, but .net especially. Im not too sure how WM_MOUSEMOVE works. Say you wanted to just click and item and drag it across the screen, would you need a while loop constantly checking the co-ordinates?
    Would you be able to provide some reading or sample code to describe how its used?
    Thanks for your help either way,
    M

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Click and hold/drag

    When the mouse moves you get a message. Process the message. If the mouse is "continuously" moving, you will get the message repeatedly. The message also tells you what mouse buttons are pressed (if any), and whether the CTRL or SHIFT keys are pressed.

    No need to constantly check coords. They are passed to you in the message.

    Viggy

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center