How to Automatically Exit Edit Mode of String Control When Using a Barcode Reader?

Updated Nov 4, 2022

Reported In

Programming Language

  • LabVIEW G

Issue Details

I'm using a barcode reader to fill out a String control on my application, but everytime a fill it out triggering the barcode reader I need click on my front panel or press Enter to exit the edit mode and just then my event case is triggered.

How can I make that not be necessary? How do I do to the barcode reader trigger my event case?

Solution

The barcode readers return not just the barcode data, but usually some prefix and sufix. A common part of the returned data is the termination character that in general is represented by a CR (0x0D), a LF (0x0A) or both, CR/LF (0x0D,0x0A). Some of the barcode readers can be even configure to have or not the termination character and which of the option above it would be.

If that's your case you can use the termination character as an edit mode exit for the string control as well as when you press the numeric keypad Enter button. To do so, first you need to configure the string control to allow just one line, so when it receives the terminal character instead of moving the cursor to the beginning of the line, it will exit the edit mode.
  1. Right-click the String control;
  2. Check "Limit to a single line" option.

Additional Information

If you want your users to not even have to put the focus on the String control clicking on it, i.e. you want your application to have a UI which is used just to visualization and not for interaction as click, typing and so, you can use the KeyFocus property node to do so programatically.