Auto advance input field focus after barcode scan

I have an entry form (popup screen) with three fields for Part Number (text entry), Lot Number (text entry), and Quantity (integer entry). The values are scanned from a USB connected bar code reader which inputs as a stdio character stream (same as a keyboard). The barcodes have a carriage return on the end and this is needed for other systems that also use the same barcodes, so I can’t change the barcodes. I need a way to automatically advance focus from one field to the next after each barcode is scanned. Before Ignition I was using a VBA form in the previous HMI and it auto advanced to the next field. Any ideas?

Also, how do I change the tab order of objects on a screen? The present tab order is Part Number, Load Button, Cancel Button, Lot Number, Quantity. I need the order to be Part Number, Lot Number, Quantity, Load button, Cancel button.

Ignition advances to the next field from left to right and then top to bottom:

You could try putting some items in a container. All of the items in the container will be traversed before the next container on the right is used:

Thankyou AdamAustin, creative container application solved the tab order problem.

Now all I need to do is figure out how to automatically advance the focus. I’m playing around with some events but so far no joy.

Try something like this:

propertyChange event

if event.propertyName == "text":
	if chr(13) in event.newValue or chr(10) in event.newValue:

NOTE TO SELF [size=50](and you since you are reading this)[/size]: PASTING text into a text field does NOT fire the propertyChange event.

If the scanner works as a keyboard wedge:

keyPressed Event

if event.keyCode == event.VK_ENTER: event.source.parent.getComponent('Next Field Name').requestFocusInWindow()

1 Like


Thanks guys. I was working with the Keytyped event but wasn’t getting the syntax right or something, still a little new at this.

Jordan’s code worked on the KeyReleased event. The operators will be glad they don’t have to put the barcode scanner down to touch the screen to change focus now.

I tried Adam’s code too but ended up going with the KeyReleased event instead.

Do you have a similar solution for perspective, too? We are using a USB barcode scanner and the operator does not have access to PC or keyboard and the numeric fields have to advance focus automatically.