Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Description of toolbar buttons in statusbar

Posted on 1999-07-15
10
Medium Priority
?
326 Views
Last Modified: 2013-12-25
Many applications use to show a description of a toolbar button on the statusbar, when pointing with the mouse on the button (like an extended form of the tooltip). I use a toolbar and a statusbar from the mscomctl.ocx collection. How can I achieve this?
0
Comment
Question by:liljegren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 7

Expert Comment

by:Vbmaster
ID: 1495391
You can use the GetCursorPos API in the Toolbar's Mousemove event. That will tell you at what position the mouse cursor is, all buttons have a Left and Width property so you can see if the mouse cursor is over the button.

Maybe there's a quicker way have never worked with M$ Toolbar control..
0
 
LVL 1

Accepted Solution

by:
jcastr earned 150 total points
ID: 1495392
Use the TAG Property of each Button to put some description of the action asociated.

Use the Toolbar1_MouseMove Event to set the statusbar text ...

  DoEvents
  StatusBar.Panels(1).Text = Toolbar1.Buttons(Button.Index).Tag


That's all

0
 

Author Comment

by:liljegren
ID: 1495393
Afraid I need more assistance. The Mousemove even already have a variable called Button (which refers to mouse buttons), so I get the error "Invalid qualifier". I also tried with the same (module global) variable I used to make the buttons and give them tooltips, but that variable only refers to the last button.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:jgv
ID: 1495394
jcastr's answer will not work because the 'Button' parameter in the MouseMove event refers to the mouse buttons, not the toolbar buttons. This should work for you. Start a new project and place a toolbar and statusbar on the form. Copy this code and run.

Private Sub Form_Activate()
Dim btn As Button
Dim cnt

For cnt = 1 To 8
    Set btn = Toolbar1.Buttons.Add(cnt, , Str(cnt))
    btn.Tag = "Button " & cnt
Next

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   StatusBar1.Panels(1).Text = ""
End Sub

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

Dim indx
Dim is_over_button As Boolean

is_over_button = False

For indx = 1 To Toolbar1.Buttons.Count
    With Toolbar1.Buttons(indx)
      If X > .Left And X < (.Left + .Width) And _
      Y > .Top And Y < (.Top + .Height) Then
          StatusBar1.Panels(1).Text = .Tag
          is_over_button = True
      End If
    End With
Next

If is_over_button = False Then StatusBar1.Panels(1).Text = ""

End Sub

0
 
LVL 7

Expert Comment

by:Vbmaster
ID: 1495395
I checked out the Toolbar_Mousemove and there's X and Y variables there, why not use them? (no need to use the GetCursorPos!)

Something like this..

Private Sub Toolbar1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

  Dim a As Long
 
  Me.Caption = 0
  With Toolbar1.Buttons
    For a = 1 To .Count
      If (x > .Item(a).Left) Then
        If (y > .Item(a).Top) Then
          If (x < .Item(a).Left + .Item(a).Width) Then
            If (y < .Item(a).Top + .Item(a).Height) Then
              Me.Caption = a
              Exit For
            End If
          End If
        End If
      End If
    Next
  End With

End Sub

This wil tell you which button the mouse is over.

0
 
LVL 7

Expert Comment

by:Vbmaster
ID: 1495396
Oops, jgv answered this while i was typing, forget about my last comment =)
0
 
LVL 12

Expert Comment

by:jgv
ID: 1495397
Did you find a solution liljegren?
0
 
LVL 12

Expert Comment

by:jgv
ID: 1495398
If the currently proposed answer is wrong and someone solves your problem with a comment then you should reject the answer and award the points to the appropriate person. In this case it would be myself or Vbmaster. This is simply a matter of courtesty and the fair thing to do.
Normally I don't bother making these mentions but sometimes it tick's me off when I or someone else provides proper working solutions and it's not even acknowledged.
0
 

Author Comment

by:liljegren
ID: 1495399
I'm terribly sorry, I just forgot this question. Got a note from EE today.
0
 
LVL 12

Expert Comment

by:jgv
ID: 1495400
LOL!! :o)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question