Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 7, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

To Flash or Not to Flash

Often, to create status-bar help, you place code in the mouse-move event procedures of controls to place text describing the control on the status bar. Every time you update the text property, the control repaints.

Because the mouse-move event will fire many times over one control, the repainting causes flashing. To avoid the strobe light effect, check the text property of the status bar to determine if the appropriate text is already shown. Then the repainting is done only once for every control.

This subroutine is handy for use with all controls:

Public Sub StatusText(NewText As String)
'If status text is already correct, 
'don't change it
If FrmMain.StatusBar.Panels(1).Text <> _
        NewText Then
FrmMain.StatusBar.Panels(1).Text = _
End If
End Sub

To use the subroutine, add this code to the mouse-move event procedure of the controls you wish to have status-bar help:

Private Sub _
        CmdEnterValue_MouseMove(Button As _
                Integer, Shift As Integer, X As _
                Single, Y As Single)
        Call StatusText("Press here to _
                change the current steps value.")
End Sub

Dave Robins
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date