03-01-2011 09:23 AM
Need to catch the event when invalid input being through out, customer doesn't like the notify.
03-01-2011 09:35 AM
see the discussion here
03-01-2011 09:41 AM
Thanks for the quick reponse.
I'm not worry about the min/max. It's the multiple "." I want to catch.
Whenever it being throught out, I want to popup a error message window.
Customer doesn't like the notify.
03-01-2011 09:51 AM
May be I miss the point: for a numeric control, if you set range checking to ignore, and enter 1.2.3 or 1.2... or something like that, the old value is kept and the wrong entry is ignored: why would you like to know about this?
03-01-2011 09:57 AM
The concern is that when an invalid input, such as 1..23, being ignored and return to 0, user may not notice, and thought 1.23 is used.
So whenever an invalid input is ignored, popup an error message to notify user. CVI has a notify, but customer doesn't like it.
03-01-2011 10:03 AM
In this case I only have a 'not so elegant' suggestion: use a string control and convert the text to a number...
03-03-2011 01:22 PM
It seems CVI notify doesn't work for invalid input, only for out of range.
I'm suprised CVI swallow the invalid input silently.
03-08-2011 10:01 AM
I haven't had a big problem with this, and I plan to continue to use numeric controls instead of making everything strings, but it does seem strange that CVI doesn't catch this. I like the automatic range checking options, the programmable increment/decrement buttons, and the ease of use.
You can use a quirk in CVI to catch this: if you enter an invalid number like 1.2.3 or 3...14159 or 1-2, CVI triggers EVENT_VAL_CHANGED, but leaves the original number unchanged. So you can create a case in the callback for the numeric control for EVENT_VAL_CHANGED, and in that case check to see if the value is the same as the previous value. If it is, assume an invalid input. EVENT_VAL_CHANGED does not get fired if you just press Enter without changing the value.
There are a couple of limitations or drawbacks to this approach. It doesn't save your invalid entry, so you have to enter the whole thing again instead of just correcting your mistake. EVENT_VAL_CHANGED also gets fired if you use Delete or Backspace, even if the number you end up with is the same as the previous. So this approach will flag that as an invalid entry.
See the attached example.