LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter numeric values from string control

Hello All,

I am using a cluster of strings as inputs for information. I would like to have one of the string inputs as text values only (no numeric values). Is there a way I can disable the numeric keys when the user is entering info into this specific string control or is there a way to search and strip numeric values from a string?

thanks in advance.
0 Kudos
Message 1 of 6
(3,763 Views)
Use a filtering event for "key down?" on the string control and discard the input if the lexical class of "char" is 3 (see attached example (LabVIEW 7.0).

(A full example would add also "key repeat?", etc.)
Message 2 of 6
(3,763 Views)
Thanks altenbach, that's exactly what I was looking for.
0 Kudos
Message 3 of 6
(3,763 Views)
Excellent, I'd never have thought of that.

It would be nice to be able to limit it from the control though without having to program around it. Maybe I'll add it to the next-version wishlist.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 6
(3,763 Views)
If you need it to be really fail save, you also need to catch "value
change". This is needed to prevent pasting strings with CTRL+V. If this
happens, you have to overwrite the New Value with the Old Value using a
local.

Regards,

Wiebe.

"DavidT" wrote in message
news:5065000000050000003BBD0100-1079395200000@exchange.ni.com...
> Thanks altenbach, that's exactly what I was looking for.
0 Kudos
Message 5 of 6
(3,763 Views)
Hi,

A (complex to set up) way to do this without having to program around it, is
to start a dynamic vi template to do this.

You can make a VI template, that has a control ref as input. The template
has a while loop, and runs until the caller vi (that is not dynamic) stops.
In the while loop, several dynamic events can be polled and filtered.

This way, you can just put the vi anywhere in the code, with a reference
constant wired to it. The VI template will stop automatically, and the rest
of the main vi can be left untouched.

Regards,

Wiebe.




"shoneill" wrote in message
news:50650000000500000042BD0100-1079395200000@exchange.ni.com...
> Excellent, I'd never have thought of that.
>
> It would be nice to be able to limit it fro
m the control though
> without having to program around it. Maybe I'll add it to the
> next-version wishlist.
>
> Shane.
0 Kudos
Message 6 of 6
(3,763 Views)