LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to select all content of the string control automatically

Solved!
Go to solution

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!

0 Kudos
Message 1 of 8
(4,563 Views)

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?



Remember Cunningham's Law
Message 2 of 8
(4,510 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 8
(4,494 Views)

1.jpg

 

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!

0 Kudos
Message 4 of 8
(4,424 Views)
Solution
Accepted by topic author yeah

There is a property node call Text.Selection where you can pick the start point of the selection and the end point.

 

Message 5 of 8
(4,410 Views)

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?

Message 6 of 8
(4,400 Views)

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.

0 Kudos
Message 7 of 8
(4,369 Views)

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!

 

 

 

0 Kudos
Message 8 of 8
(4,351 Views)