I have constructed the following code that simulates the common
rollover effect when moving the mouse over a label (this example makes
the label bold.)
I'm wondering if anyone has come up with a better solution.
lq
'start code:
Private RolloverBoldFla g As Boolean
Function RolloverBold(my Frm As String, myLabel As Integer)
' Change the selected "Z" label font to bold OnMouseMove
' and un-bolds all other "Z" labels.
' Examples:
' for a label named "Z1" : OnMouseMove = RolloverBold([FormName],1)
' for a label named "Z2" : OnMouseMove = RolloverBold([FormName],2)
' etc.
' for the form detail: OnMouseMove = RolloverBold([FormName],0)
Dim ctl As Control
'determine the selected label:
If myLabel > 0 Then 'it is a label:
If Forms(myFrm)("Z " & CStr((myLabel)) ).FontBold = False Then
'reset all label buttons colors:
For Each ctl In Forms(myFrm).Co ntrols
If ctl.ControlType = acLabel And _
Left(ctl.Name, 1) = "Z" _
Then ctl.FontBold = False
Next ctl
'set selected label to bold:
Forms(myFrm)("Z " & CStr((myLabel)) ).FontBold = True
RolloverBoldFla g = True
End If
Else 'it is not a label, it is a command to reset all labels:
If RolloverBoldFla g = True Then
'reset all label buttons colors:
For Each ctl In Forms(myFrm).Co ntrols
If ctl.ControlType = acLabel And _
Left(ctl.Name, 1) = "Z" _
Then ctl.FontBold = False
Next ctl
RolloverBoldFla g = False
End If
End If
End Function
'end code