tags:

views:

311

answers:

5

Hi, I have a code which sets the tooltip for a Winforms Controls in the standard way like this :-

Tooltip tooltip = new tooltip();

toolTip.SetToolTip(control, text);

In the same application, there is a Window which is rendering a movie of some Images at 5 Frame per second using Direct3D SDK. Now, when the Movie is being rendered i.e. when it is in PLAY mode, the tooltips never appear. As soon as I pause the Movie, the tooltips start appearing.

  • CASE 1:

As a workaround I did the following change to the code -

Tooltip tooltip = new tooltip();

toolTip.InitialDelay = 50;

toolTip.SetToolTip(control, text);

Now, as soons as I introduce an INITIAL DELAY the tooltips are rendered irrespective of the Movie is playing or not ?

  • CASE 2:

If I do not put the Initial Delay and instead subscribe to OnMouseHover event of the control and then put the above two lines of code explicitly in the even handler, then also tooltips are not lost. They appear normally. But, this not a standard practice of showing tooltips.

Can anybody correct me in what is going wrong here in Tooltips rendering ? I am using .Net 2.0 & C#.

A: 

D3D video and Tooltips both use overlays (the number of screen capture programmes I've used that don't capture tooltips because of this!); so I believe that you're seeing some interference from the D3D overlay.

Could be that the video is over-drawing the tooltip because it's being rendered during playback - so the tooltip is there, you just can't see it.

I'm mystified, however, why setting an initial delay would suddenly make it work! That said, InitialDelay controls the delay that applies to the tooltip the very first time it shows, so it could be something to do with a change to how the tooltip grabs the overlay surface on which to display.

Certainly, I'd use that as the workaround rather than repeatedly constructing and assigning the tooltip as, like the other answer says, it could murder resources.

I'd find the smallest possible InitialDelay that works and go with that.

Finally - what version of Windows and DX are we talking about here? There's a couple of other threads, starting here and in a link to GameDev inside it, about issues with tooltips and DirectX; and point to the fact that there might be more going on here than just a bit of .Net weirdness!

Andras Zoltan
A: 

See ToolTip Component (Windows Forms) at http://msdn.microsoft.com/en-us/library/he23h308(VS.85).aspx. Specifically, check out How to: Set ToolTips for Controls on a Windows Form at Design Time at http://msdn.microsoft.com/en-us/library/s894w4aa(VS.80).aspx.

You are not using the ToolTip properly. The example you linked to only shows how to create a ToolTip, not how to use it.

AMissico
A: 

Thank You all for your replies.

@ Henk

"ToolTip relies on Idle events from the MsgLoop and that the video prevents those"

Can you please elaborate on idle events ? I might get some help in debugging on these lines.

@ Andras,

I also observed that the Video is paying inside "Process A". Now, "Process B" hosts "Process A". Then the tooltips present on the controls inside Process B also do not appear while the movie is ON (in Process A). After PAUSE, they start appearing (in Process B).

I am using Windows XP with SP2 & DirectX Feb 2006 SDK. And, yes, I agree that the 2nd method is not a good practice.

@ AMissico I tried the way you suggested, but that does not fix the problem.

DotNeyGuy
I think it would be better if you added comments to our questions, instead of adding an answer that does not apply. If you had a comment, we get notified, so can reply if needed.
AMissico
A: 

Modify this for you case. Should work. You should set all of these properties.

            // Create the ToolTip and associate with the Form container.
            ToolTip toolTip = new ToolTip();

            // Set up the delays for the ToolTip.
            toolTip.AutoPopDelay = 15000;
            toolTip.InitialDelay = 300;
            toolTip.ReshowDelay = 300;
            // Force the ToolTip text to be displayed whether or not the form is active.
            toolTip.ShowAlways = true;

            // Set up the ToolTip text for the Buttons
            toolTip.SetToolTip(this.button2, "TooltipText1");
            toolTip.SetToolTip(this.button3, "TooltipText2");
Blankasaurus
A: 

@Casoninabox As I had mentioned in my post that "InitialDelay" does the trick. But, I am not getting why? ICan somebody explain me this ? Setting properties like this wont allow me to understand the root cause. It will just give another abstraction to the current issue momentarily.

DotNeyGuy