|
-
Sep 20th, 2006, 04:43 AM
#1
Thread Starter
New Member
Mouseover buttons and tooltips
Hello, my first post here.
I have a problem with tooltips. I have mouse over function in my application buttons (picture boxes) and because of that the tooltips don't work. This is the code that I am using and which seems to block the tooltips:
Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0 Or X > Picture2.Width) Or (Y < 0 Or Y > Picture2.Height) Then
Call ReleaseCapture
Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
ElseIf Picture2.hWnd <> GetCapture Then
Call SetCapture(Picture2.hWnd)
Picture2.Picture = LoadPicture(App.Path & "\Pics\new_over.gif")
End If
End Sub
I have tried to use also the xp style balloon tooltips but with no luck... any succestions? Thanks
-
Sep 20th, 2006, 04:52 AM
#2
Hyperactive Member
Re: Mouseover buttons and tooltips
welcome to the forum! To make code easier to read, use vbtags
Hello, my first post here.
I have a problem with tooltips. I have mouse over function in my application buttons (picture boxes) and because of that the tooltips don't work. This is the code that I am using and which seems to block the tooltips:
VB Code:
Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0 Or X > Picture2.Width) Or (Y < 0 Or Y > Picture2.Height) Then
Call ReleaseCapture
Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
ElseIf Picture2.hWnd <> GetCapture Then
Call SetCapture(Picture2.hWnd)
Picture2.Picture = LoadPicture(App.Path & "\Pics\new_over.gif")
End If
End Sub
I have tried to use also the xp style balloon tooltips but with no luck... any succestions? Thanks
-
Sep 20th, 2006, 04:58 AM
#3
Re: Mouseover buttons and tooltips
 Originally Posted by beemer
Hello, my first post here.
I have a problem with tooltips. I have mouse over function in my application
I have tried to use also the xp style balloon tooltips but with no luck... any succestions? Thanks
Welcome On The Forums,
In your code you are using two more function so you did not send the function code here, What the function doing how any one Know, About your code I want to say that you are using it on the mouse move event so it is possible when you remove mouse form there it also work. Check the Code using F8
-
Sep 20th, 2006, 05:08 AM
#4
Thread Starter
New Member
Re: Mouseover buttons and tooltips
Okay, thanks for tips
the functions that the mousemove is using look like this:
VB Code:
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCapture Lib "user32" () As Long
and I also have this:
VB Code:
Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
End Sub
so that works swell but the tooltips don't. If I remove the code in mousemove, tooltip works again
-
Sep 20th, 2006, 05:14 AM
#5
Re: Mouseover buttons and tooltips
Tool tip will appear when we move mouse over a control, so you are using two method at one event, because tool tip work on the mouse move event, and your code is on the mouse move, so change the code use it at a mouse down or mouse up
-
Sep 20th, 2006, 05:23 AM
#6
Thread Starter
New Member
Re: Mouseover buttons and tooltips
 Originally Posted by shakti5385
Tool tip will appear when we move mouse over a control, so you are using two method at one event, because tool tip work on the mouse move event, and your code is on the mouse move, so change the code use it at a mouse down or mouse up
I already have stuff in mouse down and click. The functionality of the picturebox button is when mouse is over the button it changes picture, and when clicked a different picture will appear. So if I remove code from mouse move, the button won't work as it's supposed...
-
Sep 20th, 2006, 06:15 AM
#7
Re: Mouseover buttons and tooltips
Welcome to the forums. 
I have use similiar code to yours in a boat load of applications and you are correct. It does block the tooltip from displaying. In fact, even if you hard code a tooltip
VB Code:
Picture2.ToolTipText = "Hello World"
It will not display.
The work around that I've always used is to display what I want to display as a tooltip in a label.
VB Code:
Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0 Or X > Picture2.Width) Or (Y < 0 Or Y > Picture2.Height) Then
Call ReleaseCapture
Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
Label1.Caption = "Hello World"
ElseIf Picture2.hWnd <> GetCapture Then
Call SetCapture(Picture2.hWnd)
Picture2.Picture = LoadPicture(App.Path & "\Pics\new_over.gif")
Label1.Caption = vbNullString
End If
End Sub
-
Sep 20th, 2006, 07:14 AM
#8
Thread Starter
New Member
Re: Mouseover buttons and tooltips
 Originally Posted by Hack
The work around that I've always used is to display what I want to display as a tooltip in a label
Thanks!
Nice to know somebody else has noticed that problem. I added a statusbar control to my app.
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
|