07-09-2015 03:48 AM
Hi all,
we are using barcode scanner to input string for string control. How can i replace the old data with the new ones?
1.I used keyfocus but the new data only insert behind the old ones.
2.we don't want to clear the old string before the new data inputed. because we also need to check the input string.
Thanks!
Solved! Go to Solution.
07-09-2015 05:28 AM
I'm unsure wether I understood that correctly: You have a bar code scanner that gives you a string which you want to display in a string control, right?
First of all, an Indicator is for displaying data a control is for data input. That said, passing a value to the string element should completely overwrite it. Can you post an example of what's not working for you, so we can get a better idea?
07-09-2015 05:42 AM
If you use an Event Structure, you get an event when the value of the string has changed. You can use that to get the new string (will likely need to use the Substring function to strip off the "old" string), do your checks, and even set the value back to the old value if the validation check fails.
07-09-2015 07:42 PM
Hi both,
the first time,the string control is empty, so i can input 11111111 with barcode scanner easily, but after that, i want to input 22222222 and the problem came. because 22222222 only come out behind 11111111, but i need to replace 11111111 with 22222222 by barcode scanner.
can i use a property node to select 11111111 so as to be replaced by next input?
and i don't want to clear 11111111 until we try to scan next data.
Thanks!
07-09-2015 08:16 PM - edited 07-09-2015 08:17 PM
There is a property node call Text.Selection where you can pick the start point of the selection and the end point.
07-09-2015 08:27 PM
How are you writing to that indicator that is causing the concatenation? Are you doing that manually or is that how your barcode scanner handles the string?
07-09-2015 09:50 PM
He said he used keyfocus. That is probably putting the cursor into the control at the end of the string. His barcode scanner is probably set up to be a keyboard wedge. Windows just treats the data coming from it like it is coming from the keyboard.
If the scanner as a serial port mode, that is usually the better way to communicate with it. Let your program handle the event of it sending data, That way you don't accidentally type stuff into other controls by scanning something when you don't intend to.
07-09-2015 10:24 PM
Hi RavensFan,
You know what i mean exactly, text selection works, i tried this before, but i didn't know the two elements are start and end.
the program can check the string to advoid wrong data. thank you for your help!
Hi All,
Thank you for all your help!