Results 1 to 4 of 4

Thread: ToolBar

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Location
    Malaysia
    Posts
    71

    ToolBar

    Hello
    i want to write the code for toolbar mousemove. means when i mousemove on buttons it has to popup the message button caption. how can i
    on

  2. #2
    Addicted Member -=SC@RF@C3=-'s Avatar
    Join Date
    Apr 2002
    Location
    Somewhere in the middle
    Posts
    158
    try this one........ click ur command button and select the mousemove property


    VB Code:
    1. Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  MsgBox "Welcome to POP-UP!!!"
    3. End Sub

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    I think they're asking about the Toolbar control, and detecting which button on the toolbar control the mouse is over, then displaying that buttons caption...

    I don't know exactly how to do this, but if you know the size of the buttons, you get the X and Y coordinates of the mouse in the MouseMove event and you could calculate which button the mouse was over. Then just reset the Tooltip text, like
    VB Code:
    1. Toolbar1.ToolTipText = SomeTextHere
    Not sure this is what you want, but it's an idea.
    ~seaweed

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    This should work for you...

    I am guessing that you have buttons w/out text, just a picture, and you want to display the button caption in the Tooltip text when the user puts the mouse over the button.

    If that is true, this should work for you. I stored each button's tooltip text in the Key property of the button, and it gets displayed when the mouse goes over the button:
    VB Code:
    1. Private Sub Toolbar1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim ButtonMouseIsOver As Integer
    3.    
    4.     With Toolbar1
    5.         ' Make sure the mouse is over one of the buttons
    6.         If x < .Buttons.Count * .ButtonWidth Then
    7.             ' Determine which button the mouse is over
    8.             ButtonMouseIsOver = Int(x / .ButtonWidth) + 1
    9.            
    10.             ' Set the tooltip text to the Key of that button
    11.             .ToolTipText = .Buttons(ButtonMouseIsOver).Key
    12.         Else
    13.             ' The mouse isn't over a button, so clear the text
    14.             .ToolTipText = ""
    15.         End If
    16.     End With
    17. End Sub
    ~seaweed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width