Last week I updated some legacy code (don't we all love that?). Updating the actual code was pretty straightforward, but I decided to add some visual elements to notify the user of validation issues.
To make a long story short, I decided to popup a ToolTip() whenever a user tabs away from a control and a validation error is raised.
Now this code (which I've simplified to illustrate) seems to work fine, but there's a snag. If the mouse cursor hovers above the control when the ToolTip() is displayed for that control, the ToolTip() stem points to the wrong location.
Move the mouse cursor away from the control, tab to the next control and it will point to the control you have specified. Google didn't really help. Some mentioning of the issue, but vary vague and non-specific.
So in the end, I resorted to writing a (static) class to determine whether the mouse cursor is above the control which will receive the ToolTip(), move the mouse away from the control and back again after the ToolTip() has been displayed (hiding the cursor doesn't work... I've tried). Not really elegant, but it works.
Maybe someone has encountered the same problem? Maybe there's a better solution?
Environment:
Microsoft ® Visual Studio 2008
Microsoft ® .NET framework 3.5
Microsoft ® Windows XP (SP2)
0 comments:
Post a Comment