|
-
Jul 2nd, 2002, 06:25 AM
#1
Thread Starter
Addicted Member
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
-
Jul 2nd, 2002, 07:06 AM
#2
Lively Member
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.
-
Jul 2nd, 2002, 07:11 AM
#3
Thread Starter
Addicted Member
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
-
Jul 2nd, 2002, 01:39 PM
#4
Lively Member
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.
-
Jul 2nd, 2002, 09:57 PM
#5
Thread Starter
Addicted Member
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
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
|