[.net] Tooltip forced display

Started by
2 comments, last by joelmartinez 19 years, 9 months ago
Is there any way to force a tooltip to display?
Advertisement
How do you mean by force it to display? As in force it to display even when the mouse isn't over it? Or force it to display even when the form doesn't have focus? If it's the later, then you can simply set the ShowAlways property of the ToolTip object to true. As for the former, I do not know of a way in which you can force tooltips to display without a mouse event.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

What I wanted was the tooltip to display when the mouse cursor hovered over something that was part of an OpenGL window. And I found a ugly hack way to do it. Use SetTooltip(...) to bind it to the OpenGL window using empty text parameters to turn off the tooltip. When the mousecursor goes over a part of the openGL window (check during a mousemove event), see if it is over any tooltip displaying objects. If it is, use SetTooltip with a string representing that tooltip. If it has moved off that object, use an empty string to reset it. This implementation has one flaw being that if you want more than one tooltip displayed at once (probably not...) this will mean that you'll need more than one Tooltip object.
I think that's a perfectly good way to implement what you're asking about. What's so ugly about it? and I do agree that you probably would not want to display more than one tooltip at a time ... talk about confusing for the end user.
Joel Martinez
http://codecube.net
[twitter]joelmartinez[/twitter]

This topic is closed to new replies.

Advertisement