Results 1 to 5 of 5

Thread: "Inverse" Mouse Move Event

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    "Inverse" Mouse Move Event

    I want to trap the mouse move event when the mouse is moving over any screen position EXCEPT over a specific control. Any ideas?

  2. #2
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Hi

    Do you want to Subclass the mouse event..

    If you want to restrict the mouse move in a particular area on your form then you can try this..

    use the following api in the MouseMove sub of your form
    VB Code:
    1. Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  3. #3

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Hi

    Originally posted by pradeepkrao
    Do you want to Subclass the mouse event..
    [/Highlight]
    Sorry I wasn't too clear in my previous post. It's not the mouse I want to trap to a specific area. Rather I want to trap the -shall I call it "screen.mousemove"?- event, i.e. I want some code to be triggered as soon as the mouse is no longer over a specific control, no matter where it goes to elsewhere on the screen.

  4. #4
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Hi

    So you want to do a Mouse Leave Event..

    I had done some thing like this....

    Copy the following Code
    create a form and put some labels i.e. label control array..

    run the program and move the mouse over the label and form.. see what happens..

    VB Code:
    1. Dim selected As Integer
    2. Dim i As Integer
    3. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    4.     selected = -1
    5.     For i = 0 To Label1.UBound
    6.         Label1(i).FontBold = False
    7.     Next
    8.    
    9. End Sub
    10.  
    11. Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    12.     If Index = selected Then Exit Sub
    13.    
    14.     For i = 0 To Label1.UBound
    15.         Label1(i).FontBold = False
    16.     Next
    17.    
    18.     Label1(Index).FontBold = True
    19.    
    20.     selected = Index
    21.    
    22. End Sub
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

  5. #5

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Hi

    Originally posted by pradeepkrao
    So you want to do a Mouse Leave Event..

    I had done some thing like this....

    Copy the following Code
    create a form and put some labels i.e. label control array..

    run the program and move the mouse over the label and form.. see what happens..[/Highlight]
    Well, that's closer to want I want, however the problem is I don't have an array of labels, rather a large number of controls of diferent types. I don't want to write code for the mousemove event of each and every one of these controls, you see what I mean?
    The idea is, as it were, to simulate a "mouse_not_move" subroutine for that special control.

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