Losing Key Focus in LabVIEW When Using a 2D Scanner

Updated May 22, 2024

Reported In

Software

  • LabVIEW

Other

  • 2D scanner

Issue Details

I am using a 2D scanner in a localized OS to get information directly from a barcode. Scanner is detected as a keyboard but when I scan, I only have a portion of the expected data as I'm losing key focus. I tried to use the Key Focus property node but it still misses some information.

Solution

2D barcodes have data that is usually read as a list. Most of the time, the list is formatted with return chariot characters that will cause the key focus behavior observed. To avoid this you have two options:
  • You can check the Vkey output. In this example, you can replace the return chariot by a new line: you need to create an event structure on the command string inside a while loop and use the filter "Key Down?" to replace the return chariot, as shown in the snippet:
2Dscanner.png
  • You can check the Char output. In this example, you can ignore the return chariot or new line character : you need to create an event structure on the command string inside a while loop and use the filter "Key Down?" and ignore the return chariot or new line by using the "Discard?" input, as shown in the snippet:
2DscannerChar.png