On Mouseover

PaulSpell

Registered User.
Local time
Today, 12:44
Joined
Apr 19, 2002
Messages
201
Does anyone have some code that replaces the old "On Mouseover" event in AXP?
 
The closest I can get is with a routine that uses On MouseMove. But this isn't very good because it makes the form flicker too much!

I'm sure this can't be done anymore, but if you know different then please let me know.
 
If you're trying to simulate mouse rollover effects, then MouseMove is the right event to use. I'm not sure why your form is flickering though. Do you have lots of objects packed really close together?
 
The reason the form is flickering is because I have written a generic function that loops through all of the controls on the form and re-sets the forecolor and mouse pointer depending on whether or not the cursor is over the control passed to the function as an argument. Here is the code:

Option Compare Database
Private ctlOver As Control

Function LoopCntrls(Optional ctlNameIn As String)

For Each ctlOver In Me.Controls
If IsNull(ctlNameIn) Or ctlNameIn = "" Then
ctlOver.FontUnderline = False
ctlOver.ForeColor = "0"
Screen.MousePointer = "0"
ElseIf ctlNameIn = ctlOver.Name Then
ctlOver.FontUnderline = True
ctlOver.ForeColor = "16737843"
Screen.MousePointer = "1"
Else
ctlOver.ForeColor = "0"
End If
Next ctlOver

End Function


Therefore it is the constant looping that is causing the flickering. Because the code is triggered by the mousemove event, it is running more or less all of the time.

I can't think of another way of doing this that achieves the same result.

Ideally I would like to just change the mousepointer to the pointing finger when it moves over text boxes. This is easily done with command buttons, labels etc but not text boxes.

Let me know if you have any ideas.
 
It flickers because when you move a mouse the event is triggered a number of times, refreshing/recalculating the control.

If you are wanting to change something then you should check that it does not already equal that value.

i.e.

Code:
Private Sub lblMyName_MouseMove([i]whatever the parameters are[/i])
    With Me.lblMyName
        If .BackColor = vbRed Then .BackColor = vbBlack
    End With        
End Sub
 

Users who are viewing this thread

Back
Top Bottom