Announcement

Collapse
No announcement yet.

Detecting mouse position

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Semen Matusovski
    replied
    Thanks, Dave.
    I tried. Unfortunately not works. Perhaps, I do something wrong, but I think that explanation in another - a parent is a console window. First (and last) %WM_CAPTURECHANGED appears after second (!) SetCapture.

    ------------------

    Leave a comment:


  • Dave Navarro
    replied
    Another way to do it is to "capture" the mouse as soon as it enters your button area and then compare it's position as it moves with the size/location of your button, when the mouse leaves the button area then ReleaseCapture.

    That's how Microsoft does it.

    --Dave


    ------------------
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Semen Matusovski
    replied
    Jules --
    nice idea, works. One problem less.
    Thanks

    ------------------

    Leave a comment:


  • Jules Marchildon
    replied
    Semen, there is no such WM_MOUSELEAVING message, so instead
    we need creativity here.

    Only suggestion is to use a timer like a watch-dog.
    1/10th of second watch-dog timer should work. Every time-out you
    can GetCursorPos(), and translate to screen coordinates and
    compare with your buttons coordinates to see if the mouse is
    still inside this controls RECT. If not the mouse must have
    left the building.


    HTH
    Regards, Jules


    [This message has been edited by Jules Marchildon (edited February 04, 2000).]

    Leave a comment:


  • Semen Matusovski
    started a topic Detecting mouse position

    Detecting mouse position

    Hi, all !
    I try to place non-modal elements on console window.
    I create and register own class of windows -
    (popup, parent is a console window) and have "full" access to all messages.
    Now I imitate a work of "button", and after mouse-down I need to detect mouse-up (it's easy) and a moment, when mouse is leaving my window to do automatic "turn off".
    I have "mouse-move" event, can understand that mouse is near border (for example, position (1,1)), but not more, because mouse-move not occurs with step 1 pixel.
    Any ideas ?
    Thanks

Working...
X