|
-
April 6th, 2003, 02:58 PM
#1
Mouse out
Hello.
I want an image to be visible when the mouse pointer is over a Label.
There are many labels with the same name, the one I want has its index=8.
I'm using the MouseMove event to make the picture visible, which works fine.
The problem is when I move the mouse out of that label.
I have found many posts here about this... The problem appears when I move the mouse very fast. In some cases it can move out of the label without disappearing the picture.
So sometimes it works, sometimes not.
I really want to make the picture appear when the label's ToolTipText appears.
Is there any function that I could use to understand when a toolTipText is displayed and when not?
Because I think it can't be done with the MouseMove...
Thanks in advance :-)
Visit www.greekroms.net
Greek translations of roms
-
April 6th, 2003, 04:47 PM
#2
Strange question in my opinion.
Anyhow, why do you worry about fast Mose Move, Afterall Microsoft_ itself has not overcome the sort of "problem" you are against to.
As for as Tooltip Text part. Play a trick,
1) Design a label as tool tip text window.
2) Make it appear when you want... 
3) You may like to use Timer control for this task as well.
Happy Programming,
myMessage: Pray For Peace.
Älwäÿ§ T®ü§t ¥öü® §ëlf , Nöt Öthë®§
-
April 7th, 2003, 03:30 PM
#3
If it's true that Microsoft itself hasn't overcome this problem, then I should just forget it.
As for the ToolTipText part, it seems you didn't understand what I wanted...
I want to know when the real ToolTipText appears and disappears.
If I make my own ToolTipText, I will have the same problems with the fast mouse movement.
Thank you anyway neagle :-)
Visit www.greekroms.net
Greek translations of roms
-
April 7th, 2003, 06:25 PM
#4
Hmmm...
Since the label doesn't have an hWnd, you can't use SetCapture in order to know when the mouse moves off of it. However, you can use the mousemove event of the form, or whatever the labels are on, in order to do it. So just reset the image when the mouse moves on the form. As for the delay until the tooltip appears, you can use a timer.
-
April 9th, 2003, 12:44 PM
#5
I have thought of that, WizBang, but I'm afraid I have to do it for everything that's on my form... and unfortunatelly there are many things there :-P
As for the ToolTipText delay, I never said I want to control that. I said I wanted to know when it appears or disappears...
Thank you very much :-)
Visit www.greekroms.net
Greek translations of roms
-
April 9th, 2003, 12:48 PM
#6
I think there's a tooltip event for controls ... something like ON_TOOLTIPNOTIFY ... You might be able to get the windows API and whip up a callback function ...
-
April 9th, 2003, 08:40 PM
#7
Well, one way around it would be to use a control with an hWnd, and then SetCapture would work. It would use more resources, but avoid using a hook. However, if your labels are all in a group of some sort, then you may be able to put them in a frame, and then SetCapture will work. Like This:
Code:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim RC As RECT
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function PtInRect Lib "user32" (lpRect As RECT, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Form_Load()
SetRect RC, Label1(1).Left, Label1(1).Top, Label1(1).Left + Label1(1).Width, Label1(1).Top + Label1(1).Height
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X < 0 Or Y < 0 Or X > Frame1.Width Or Y > Frame1.Height Then
ReleaseCapture
Else
SetCapture Frame1.hWnd
End If
If PtInRect(RC, X, Y) Then Label1(1).BackColor = vbRed Else Label1(1).BackColor = &HC0C0C0
End Sub
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
|