Use scanner change from one text input to another


i have a project that will use scanning gun to scan the barcode
after the scan the data, it will have enter and line feed,
i want to know how to after success scan the data to the upside text-input, then it will automatically change to the downside text input, i will no need use the mouse to move to that position, use which scripting? thanks a lot

You could add a property change event script on the top field so that when the text property changes, it writes the text into the bottom field?

image
for example, if i have 3 text input
if i want to write the message in text input 1, i should first use mouse click the text input1.
after i write the data, i want to write the data for second input, i should the mouse click this position , or use Tab of the keyboard
image

is there any scripting , if the property changes, it can works as a tab function , enable me directly write the data to the second input, no need keyboard or use mouse to click

Ah, I see now. Yes, you can add a property change event to the top field to check for when the text changes, and then you can use grabFocus() to move focus to the 2nd field.

E.g.

If event.propertyName == 'text':
    event.source.parent.getComponent('textfield2').grabFocus()

Make sure your text fields have defer updates options checked

(see available methods/properties from the javadoc for PMITextField for where grabFocus() came from)

1 Like

image
thanks for your support , it works, it will be very easy for my operator just use scanner to switch to another text input, make life easy :grinning: :grinning: :grinning: