Results 1 to 8 of 8

Thread: Mouseover buttons and tooltips

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    7

    Question 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

  2. #2
    Hyperactive Member Bearnerd's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    290

    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:
    1. Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. If (X < 0 Or X > Picture2.Width) Or (Y < 0 Or Y > Picture2.Height) Then
    3. Call ReleaseCapture
    4. Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
    5. ElseIf Picture2.hWnd <> GetCapture Then
    6. Call SetCapture(Picture2.hWnd)
    7. Picture2.Picture = LoadPicture(App.Path & "\Pics\new_over.gif")
    8. End If
    9. End Sub

    I have tried to use also the xp style balloon tooltips but with no luck... any succestions? Thanks

  3. #3
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: Mouseover buttons and tooltips

    Quote 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

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    7

    Re: Mouseover buttons and tooltips

    Okay, thanks for tips

    the functions that the mousemove is using look like this:
    VB Code:
    1. Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
    2. Private Declare Function ReleaseCapture Lib "user32" () As Long
    3. Private Declare Function GetCapture Lib "user32" () As Long

    and I also have this:

    VB Code:
    1. Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
    3. End Sub

    so that works swell but the tooltips don't. If I remove the code in mousemove, tooltip works again

  5. #5
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    7

    Re: Mouseover buttons and tooltips

    Quote 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...

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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:
    1. 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:
    1. Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. If (X < 0 Or X > Picture2.Width) Or (Y < 0 Or Y > Picture2.Height) Then
    3.    Call ReleaseCapture
    4.    Picture2.Picture = LoadPicture(App.Path & "\Pics\new.gif")
    5.    Label1.Caption = "Hello World"
    6. ElseIf Picture2.hWnd <> GetCapture Then
    7.    Call SetCapture(Picture2.hWnd)
    8.    Picture2.Picture = LoadPicture(App.Path & "\Pics\new_over.gif")
    9.    Label1.Caption = vbNullString
    10. End If
    11. End Sub

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    7

    Re: Mouseover buttons and tooltips

    Quote 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
  •  



Click Here to Expand Forum to Full Width