Loosing Key Focus in LabVIEW When Using a 2D Scanner

Updated Mar 31, 2021

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 loosing key focus.
I tried to use the Key Focus property node but it still misses some information.

Solution

2D barcode have data that is usually read as a list. Most of the time, the list is formated with return chariot characters which will cause the key focus behaviour 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