Results 1 to 5 of 5

Thread: UserControl tooltips - how to enable them?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Location
    Novosibirsk, Russia
    Posts
    170

    UserControl tooltips - how to enable them?

    Hi!

    I have made a usercontrol (ActiveX). It has a rather complex painting procedure which uses WinAPI drawing functions on a temporary device context handle (memory dc), and at the end of the painting cycle bitblt's the contents of the DC to the control DC. When placed on the form, the control has ToolTipText property, but it does not work (there are no tooltips displayed). I have looked into some other button controls out there and I found one that solves the problem by creating tooltips using WinAPI, but for some reason the code from that project doesn't work in mine.

    Could you please help?

    Thanks a lot in advance!

    Stanislav
    Stanislav Okhvat
    [email protected]
    VB, PHP

  2. #2
    Lively Member The Hand's Avatar
    Join Date
    Jun 2001
    Posts
    88

    Post

    If you use GetCapture/SetCapture for a MouseLeave / hover / rollover effect then it will disable the tooltips.

    There are a few other things which can prevent them from displaying, but that is the most common.
    Visit EliteVB for slimy subclassing tricks and GDI32 goodness.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Location
    Novosibirsk, Russia
    Posts
    170

    Thanks!

    Thanks! This is exactly what I am doing and the tooltips won't work. Is there perhaps another good alternative to SetCapture?

    Thanks a lot in advance,

    Stanislav
    Stanislav Okhvat
    [email protected]
    VB, PHP

  4. #4
    Lively Member The Hand's Avatar
    Join Date
    Jun 2001
    Posts
    88

    Post

    The only other solution I've ever seen was pretty cheesy, albeit effective - Using a timer control with a very short interval (I think they have a max res of 55ms), you can use the GetMousePos() API to check and see if its inside your control. You enable the timer in the MouseMove() event, and disable it when the _Timer() event fires and you find the cursor outside your control.

    I'm sure there is something better you can do with subclassing, but honestly I've never fooled with it. I've just lived without tooltips.
    Visit EliteVB for slimy subclassing tricks and GDI32 goodness.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Location
    Novosibirsk, Russia
    Posts
    170

    Other methods

    Hi and thanks for your tip!

    The GetMousePos() combined with a Timer should be effective, although it's not that effective from the processor viewpoint. I found a solution on vbAccelerator which requires subclassing of the WM_MOUSEOVER message and a number of other messages. My main idea was to create a usercontrol which could be dropped into any project and function just like a normal ActiveX control added into the Components pane, but with subclassing I will need to create a separate module. Well, anyway, I guess this will have to be done. It will also allow me to make the button more like the standard button because I would be able to intercept key presses on the control's parent (and thus correctly handle Default and Cancel properties' functionality).

    Thanks a lot for your help and ideas!

    Stanislav
    Stanislav Okhvat
    [email protected]
    VB, PHP

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