Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse Over Colour Change

Status
Not open for further replies.

LJtechnical

Technical User
Aug 7, 2002
90
0
0
GB
Hi All

I have a mouse move event that changes the colour of a control when moused over. This is reset when the background (form detail) is moused over.

The problem is if you move the mouse pointer quickly over all the controls it is possible to have them all stay in the moused over colour.

Anyone know of a way round this?

Cheers
 
erm, what event are you using for the mouseOver?

you should use a mouseOut event in the control itself to reset the colour, not in the mouseOver event of the details section...

--------------------
Procrastinate Now!
 
I guess you are using a newer version of Access. I'm using Access 97 and have not come across a MOUSE OUT event.
 
there's isn't one in my version either...

but then again, there isn't a MouseOver in my version, so I thought you were using the MouseMove event, in which case, you can adapt it to do something similar to a mouseOut...

--------------------
Procrastinate Now!
 
I use a variable that is set to true when you change the color, and reset to false when you set it back to the original color.. as in this example:

Option Compare Database
Option Explicit

Dim mstPrevControl As String
Dim blnSet As Boolean

Function fSetColor(stControlName As String)
' ***********************************************************************************
' * Changes the color of the label Font *
' * when the mouse passes over a command button, lets the user know what button *
' * will be selected when the mouse is clicked
' * Requires a Modular Variable: Dim mstPrevControl As String
' ***********************************************************************************
If blnSet = False Then
On Error Resume Next
With Me(mstPrevControl)
.ForeColor = vbBlack

End With
mstPrevControl = stControlName
With Me(stControlName)
If Me(stControlName).Name = "cmdExit" Then
.ForeColor = vbRed
Else
.ForeColor = vbBlue
End If

End With
blnSet = True
End If
End Function

Function fResetColor()
' ****************************************************************************
' * Resets color of control changed in Function fSetColor() *
' ****************************************************************************
If blnSet = True Then
On Error Resume Next
With Me(mstPrevControl)
.ForeColor = vbBlack
End With
blnSet = False
End If
End Function


PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top