|
-
Jul 29th, 2003, 07:51 AM
#1
"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?
-
Jul 29th, 2003, 08:27 AM
#2
Fanatic Member
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:
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
-
Jul 29th, 2003, 09:07 AM
#3
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.
-
Jul 29th, 2003, 09:15 AM
#4
Fanatic Member
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:
Dim selected As Integer
Dim i As Integer
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
selected = -1
For i = 0 To Label1.UBound
Label1(i).FontBold = False
Next
End Sub
Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Index = selected Then Exit Sub
For i = 0 To Label1.UBound
Label1(i).FontBold = False
Next
Label1(Index).FontBold = True
selected = Index
End Sub
-
Jul 29th, 2003, 09:29 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|