i have a label1 on a form
possible to check, with mouse move event, when the cursor is out the label1?
MOUSE move event lost label
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: MOUSE move event lost label
You could use code like this:
When the mouse is over the label, the variable blnOnLabel is True, otherwise it is False.
If you have controls that are immediately adjacent to the label, you have to set blnOnLabel = False in the MouseMove event of those controls too.
Code: Select all
Private blnOnLabel As Boolean
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
blnOnLabel = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
blnOnLabel = False
End Sub
If you have controls that are immediately adjacent to the label, you have to set blnOnLabel = False in the MouseMove event of those controls too.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: MOUSE move event lost label
OPS...HansV wrote: ↑09 Nov 2022, 11:08You could use code like this:
When the mouse is over the label, the variable blnOnLabel is True, otherwise it is False.Code: Select all
Private blnOnLabel As Boolean Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) blnOnLabel = True End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) blnOnLabel = False End Sub
If you have controls that are immediately adjacent to the label, you have to set blnOnLabel = False in the MouseMove event of those controls too.
have an array label, named LP.
in effect when the cursor is not on one of the labels of the array, i need:
Me.LPR.Caption = ""
Me.LPROVINCIA.Caption = ""
i use:
Code: Select all
Private Sub LP_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
PR = Me.LP.Item(Index).Tag
For I = LBound(DBPR) To UBound(DBPR)
If Left(DBPR(I), 2) = PR Then
PROVINCIA = Split(DBPR(I), "-")(1)
Exit For
End If
Next I
Me.LPR.Caption = PR
Me.LPROVINCIA.Caption = PROVINCIA
DoEvents
End Sub
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: MOUSE move event lost label
Try
I cannot test this myself!
Code: Select all
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.LPR.Caption = ""
Me.LPROVINCIA.Caption = ""
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: MOUSE move event lost label
actually...HansV wrote: ↑09 Nov 2022, 12:10Try
I cannot test this myself!Code: Select all
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Me.LPR.Caption = "" Me.LPROVINCIA.Caption = "" End Sub
in effect i have a picturebox1 and the Italy map.
Each black initial have a lp label of array, the tag of each lp, have initial of city.
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: MOUSE move event lost label
what do you think about it:
Code: Select all
Private Sub LP_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
PR = Me.LP.ITEM(Index).Tag
For I = LBound(DBPR) To UBound(DBPR)
If Left(DBPR(I), 2) = PR Then
PROVINCIA = Split(DBPR(I), "-")(1)
Exit For
End If
Next I
Me.LPR.Caption = PR
Me.LPROVINCIA.Caption = PROVINCIA
DoEvents
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.LPR.Caption = ""
Me.LPROVINCIA.Caption = ""
DoEvents
End Sub
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: MOUSE move event lost label
I don't have VB6, so I have no idea. Does it work for you?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78595
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands