Mouse Event on Controls 
Author Message
 Mouse Event on Controls

Hi all,

    I have 2 label controls on form. I have a MouseDown, MouseMove and
MouseUp Events for both. When I down mouse on control1 and moving the mouse
without releasing mouse and release it on second control , the  event
MouseUp is called for the first control only(Even if I am not releasing on
the same control). But I want the mousedown should be called for control1
and mouseup for 2nd control.

Hoe to do it?

Any help    !

Thanks in advance
Santhakumar B



Sat, 28 Aug 2004 20:26:18 GMT  
 Mouse Event on Controls
Hello Santhakumar,

Check out this code taken here (with some modif)
some weeks ago:
' ---
Declare Function WindowFromPoint Lib "user32"
    (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Declare Function GetCursorPos Lib "user32"
    (lpPoint As POINTAPI) As Long

Private Type POINTAPI
   X As Long
   Y As Long
End Type

Function SetCtlOver(ByRef ctlSource As Control) As Boolean
    Dim tPos    As POINTAPI
    Dim lhWnd   As Long
    lhWnd = GetCursorPos(tPos)
    lhWnd = WindowFromPoint(tPos.X, tPos.Y)
    If lhWnd = ctlSource.hwnd Then
        SetCtlOver = True
    Else
        SetCtlOver = False
    End If
End Function
' ---

Also, check out functions Get/Set/Release Capture...

Hope this helps,

Rejean Cloutier



Sat, 28 Aug 2004 21:36:12 GMT  
 Mouse Event on Controls
ListView1.HitTest
hth,
s


Quote:
> Hi all,

>     I have 2 label controls on form. I have a MouseDown, MouseMove and
> MouseUp Events for both. When I down mouse on control1 and moving the
mouse
> without releasing mouse and release it on second control , the  event
> MouseUp is called for the first control only(Even if I am not releasing on
> the same control). But I want the mousedown should be called for control1
> and mouseup for 2nd control.

> Hoe to do it?

> Any help    !

> Thanks in advance
> Santhakumar B



Sat, 28 Aug 2004 21:47:05 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Mouse events on control that has none?

2. mouse move event detected with no mouse movement?!?

3. HOWTO: Disable user mouse input but still allow software to play mouse events

4. Mouse events for all controls in one?

5. help....mouse events on shape and line controls

6. Control obtaining mouse events

7. Control mouse event outside a modal form in visual basic

8. custom control mouse events

9. HELP: How to tell mouse position after a click or dblclick event on a picture control

10. Adding some mouse event to a control...

11. Mouse move event not trapped over Scroll bars of ListView Control

12. Adding some mouse event to a control...

 

 
Powered by phpBB® Forum Software