|
-
Mar 10th, 2003, 12:09 AM
#1
Thread Starter
Lively Member
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
-
Mar 10th, 2003, 01:15 AM
#2
Addicted Member
try this one........ click ur command button and select the mousemove property
VB Code:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox "Welcome to POP-UP!!!"
End Sub
-
Mar 10th, 2003, 01:30 AM
#3
Frenzied Member
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:
Toolbar1.ToolTipText = SomeTextHere
Not sure this is what you want, but it's an idea.
-
Mar 10th, 2003, 02:11 AM
#4
Frenzied Member
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:
Private Sub Toolbar1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim ButtonMouseIsOver As Integer
With Toolbar1
' Make sure the mouse is over one of the buttons
If x < .Buttons.Count * .ButtonWidth Then
' Determine which button the mouse is over
ButtonMouseIsOver = Int(x / .ButtonWidth) + 1
' Set the tooltip text to the Key of that button
.ToolTipText = .Buttons(ButtonMouseIsOver).Key
Else
' The mouse isn't over a button, so clear the text
.ToolTipText = ""
End If
End With
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|