Flashing command button

  • Thread starter Thread starter Kazlou
  • Start date Start date
K

Kazlou

Is it possible to have a command button that flashes - to draw attention to it.
Thanks Karen
 
Kazlou said:
Is it possible to have a command button that flashes - to draw attention
to it.
Thanks Karen


Yes it can be done. Do please keep in mind though that some people may find
this behaviour very annoying. There's also the issue of people who may
suffer from epilepsy which can be triggered by flashing ...

http://www.epilepsyfoundation.org/about/photosensitivity/

According to the above article, problems are most likely with flash rates
between 5 and 30 per second, so avoid that. I'd also advise providing users
with a way to stop the flashing (a simple way to do this is to set the
form's TimerInterval property to 0). With that said, here's one way you can
do it ...

Private Sub Form_Load()

Me.TimerInterval = 500 'twice per second

End Sub

Private Sub Form_Timer()

If Me.cmdTest.ForeColor = vbRed Then
Me.cmdTest.ForeColor = vbYellow
Else
Me.cmdTest.ForeColor = vbRed
End If

End Sub
 
One way is to show & hide the caption of the button.
In the example below my button is called btnTest and the caption is "URGENT"

Set the form property Timer Interval to 100
Put this code in the Event procedure of the forms On Timer event

f btnTest.Caption = "" then
btnTest.Caption = "URGENT"
Else
btnTest.Caption = ""
end if
 
Back
Top