- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there.
I have a simple question (well i hope its simple hehe).
We are using ToolTips on many of our controls. Works like a charm.
Since there seems to be no ErrorProvider available through the WinAPI (i love the ErrorProvider Class in .NET), or i just did not found it yet, we have to build it on our own.
The cool thing on the ErrorProvider in .NET is, that the blinking exclamation mark and the ToolTip with errortext were also made by the class itself.
We too want to do our error handling like this or in a particular way.
Well ... we decided to do this with simple ToolTips. For example if the user does make a wrong text entry (numbers instead of chars or something like that) we want the ToolTip to be generated on this control then and fired automatically so the user will see the errormessage.
But there is the big problem. ToolTips, for what i found out through hours of googling, does only get highlightet on the mousehover event. Is there any way to fire the mousehover event manually, so the ToolTip will be shown or do anyone of you do know any other way to do this?
I tried it with TTM_POPUP (Using #422 or WM_USER + 34 as those are the values i found by google) but thats not worked.
We also thought and discussed about a simple picturebox with an error icon which will be blinking, fading or something. But implement this on all controls, that we want to be error handled is...well...horror :)
Maybe the pros do know a simple way or do have any other cool ideas :)
Best Regards
Oliver
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you add an edit control to a dialog, you can specify in its properties that it only accept 'numbers' i.e. characters 0,1,2,3,4,5,6,7,8,9. In this case none of '.' or 'd' or 'e' (upper or lower case) required for floating point numbers will be accepted either. I think even the '-' and '+' will not be accepted.
If you want to specify floating point numbers, you will have to parse the character string yourself, before doing an internal read from the character string (or detect an error on internal reading of the string using an ERR= construct), in which case you will be in the perfect position to send out a message box to the user if you detect an 'error' in the entered string. AFAIK, there is no magic wand that you can wave over your code to add detection of a user entering something that only you can determine/decide is wrong or right (an 'error').
If you want to specify floating point numbers, you will have to parse the character string yourself, before doing an internal read from the character string (or detect an error on internal reading of the string using an ERR= construct), in which case you will be in the perfect position to send out a message box to the user if you detect an 'error' in the entered string. AFAIK, there is no magic wand that you can wave over your code to add detection of a user entering something that only you can determine/decide is wrong or right (an 'error').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thx for your reply.
Ahm...that case with the Edit Control was only an example to show what i meant with error providering.
I know how to check entries in this case ;)
I guess we will to it by drawing dynamically picture boxes and adding tooltips to them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you explain a bit more what it is you want to do that you cannot already do with your tool tips?
As I understand it from your posts, you have mastered the technique of adding tooltips to controls (bravo to you!) so that when the mouse cursor enters the window area covered by a control, an informative tooltip apepars on the screen which then vanishes automatically when the cursor leaves the control's window?
Now, you appear to want to cause an informative tooltip to appear when the user enters wrong data into a control, even when the mouse cursor may not be over the control, is that correct?
As I understand it from your posts, you have mastered the technique of adding tooltips to controls (bravo to you!) so that when the mouse cursor enters the window area covered by a control, an informative tooltip apepars on the screen which then vanishes automatically when the cursor leaves the control's window?
Now, you appear to want to cause an informative tooltip to appear when the user enters wrong data into a control, even when the mouse cursor may not be over the control, is that correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anthony is correct. Input errors (alphas in a num-only field, etc.) are only detected when the entire input is parsed by your code, and that activity is disjoint from mouseovers.
When an error is detected, use MessageBox() with MB_ICONEXCLAMATION to so inform your user. Attempting to use tooltips for this would be non-standard windows practice.
When an error is detected, use MessageBox() with MB_ICONEXCLAMATION to so inform your user. Attempting to use tooltips for this would be non-standard windows practice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anthony you understood it correctly.
Thats exactly what i meant.
But dont bother...we did it the way as i posted before.
No i dynamically generate a picturebox and loads an error icon in ith (animated cursor exactly). I set a ToolTip to it also.
Works like a charm :)
Its a particular way, as the ErrorProvider Class in .NET does it.
If you dont know how the ErrorProvider is working, here is an example for a textbox validation (from the users sight)
.) you type numbers and the programmer has coded a validation on this, that numbers are not allowed
.) depending on the time of validation (textbox leaving focus, textbox text changed, and so on) the ErrorProvider is valitating the control in the background with its coded steps (checking if a number is within the text).
.) Because the ErrorProvider failed at validating the textbox, the class automatically draws a blinking exclamation mark (default setting) directly on the right side of the textbox. Now if you mouse over the mark youll see the text, that the programer coded in before.
Thats the thing we now manually doing by drawing a picture box with an selfdrawn animated cursor in it and a tooltip set up to it.
My boss wantet the way i described before...a tooltip directly on the textbox, which is firing by code and not by mouse overing. But this seems to be impossible...
Well i think the selfmade ErrorProvider is the beautifullier way :)
Best regards
Oliver

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page