ON Mouse Move event

L'apprentis

Redcifer
Local time
Today, 01:44
Joined
Jun 22, 2005
Messages
177
I have a switchboard using 4 different label that open a specific form when clicked. I have been trying to add a very simple code on the "on mouse move" event of each label that change the state of the 4 labels I am using:

Code:
Private Sub Form_Current()
Me.Option1.FontBold = True
Me.Option2.FontBold = False
Me.Option3.FontBold = False
Me.Option4.FontBold = False
Me.Arrow1.Visible = True
Me.Arrow2.Visible = False
Me.Arrow3.Visible = False
Me.Arrow4.Visible = False
End Sub

The code is working fine but all the label keeps flashing when I move the mouse over the labels which is a bit annoying. I don't see How I could get the "flashing" to stop. Would it be possible to cancel the "on move mouse event" once the code has been run once?
 
Try adding:

If me.option1.fontbold = false then

Me.Option1.FontBold = True
Me.Option2.FontBold = False
Me.Option3.FontBold = False
Me.Option4.FontBold = False
Me.Arrow1.Visible = True
Me.Arrow2.Visible = False
Me.Arrow3.Visible = False
Me.Arrow4.Visible = False

end if
 
Thanks Laurentech, I never thought of using a conditional statement, makes sense and works perfectly, thanks again.
 
Laurentech said:
Try adding:

Code:
If me.option1.fontbold = false then

 Me.Option1.FontBold = True

end if

Hi,

My switchboard labels use a function to bold them on mouse over that I got from this forum. I wanted to use the fontbold = false to get rid of the annoying flicker but I am having difficulty referencing the labels. I tried

If Me(stControlName).FontBold = True Then

(see code below) and various other things but do not seem to getting any closer.

Any pointers appreciated.


Code:
One of my attempts to solve this
_______________________________________________________

Function fSetFontBold(stControlName As String)
On Error Resume Next

If Me(stControlName).FontBold = True Then
    With Me(mstPrevControl)
        .FontBold = False
        .ForeColor = 16777215
    End With
End If

mstPrevControl = stControlName
  
  If Me(stControlName).FontBold = False Then
    With Me(stControlName)
        .FontBold = True
        .ForeColor = 65280
    End With
 End If

End Function

The original code:

Code:
Function fSetFontBold(stControlName As String)
Const cBold = 700
Const cNormal = 400

    On Error Resume Next
    
    With Me(mstPrevControl)
        .FontWeight = cNormal
        .ForeColor = 16777215
    End With
    mstPrevControl = stControlName
    With Me(stControlName)
        .FontWeight = cBold
        .ForeColor = 65280
    End With
End Function

_______________________________________________________

Function fRemoveFontBold()
Const cNormal = 400
    On Error Resume Next
    With Me(mstPrevControl)
        .FontWeight = cNormal
        .ForeColor = 16777215
    End With
End Function

Thanks in advance.
 

Users who are viewing this thread

Back
Top Bottom