From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-23-2015 07:32 AM
Hi,
I want to accept only up to 4 hex characters in a string control. I dont want to use "hex display" property.
How is it possible? I have String control key down? event in event case, I tried it with regular expressions [0-9a-fA-F]{4} but then I have to accept left, right, delete, backspace, home keys as well.
Solved! Go to Solution.
05-23-2015 07:57 AM
05-23-2015 08:16 AM
I agree with Dennis that you seem to be making life difficult for yourself. However, you did ask the equivalent (as I understand it) "How can I allow the user to type "1", "2", "Ctrl-A", "B", "Ctrl-C", "D" and get this recognized as the string "12BD". If you really want to do this, here is one way (I was lazy and left the answer as an array of 4 1-character strings). I use PlatMods to exclude having any "modification" key other than Shift down, convert the numeric Char into a string, then count acceptable Hex letters and conditionally add them to the output array, stopping when I have 4 characters.
Bob Schor
05-23-2015 09:23 AM
Thanks a lot for answers and code.
Actually, I dont want it, user wants to do so. He is not familiar with string input with "hex display".
05-23-2015 09:37 AM
05-23-2015 12:12 PM
Point well taken. I'm not used to criticizing why someone wants to do something that I think is silly -- I (naively) assume that they have a good reason for doing it that way ...
BS