Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDisplay a tip in a status bar when the mouse moves over a toolbar button
DescriptionThis example shows how to display a tip in a status bar when the mouse moves over a toolbar button in Visual Basic 6. The program displays the tip message in the Toolbar's MouseMove event handler.
KeywordsToolBar, StatusBar, ToolTip
CategoriesControls
 
Thanks to Hisham Nassef.

The Toolbar's MouseMove event handler displays the message. The form's MouseMove event handler removes the message.

Note that the user can move the mouse off the top of the form without moving over the form itself and geneating a MouseMove event. One way to handle this would be to use a timer to periodically see if the mouse has moved off of the button.

 
Private Sub Toolbar1_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
Dim i As Integer

    Flag = False

    With Toolbar1
        For i = 1 To Toolbar1.Buttons.Count
            If ((X > .Buttons(i).Left) And (X < _
                .Buttons(i).Left + .Buttons(i).Width)) Then
                DisplayToolbarMessage .Buttons(i).Tag
                Flag = True
                Exit For
            End If
        Next i
    End With

    If Not Flag Then StatusBar1.Panels(1).Text = ""
End Sub

Private Sub DisplayToolbarMessage(Msg As String)
    StatusBar1.Panels(1).Text = Msg
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    If Flag Then
        StatusBar1.Panels(1).Text = ""
        Flag = False
    End If
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated