Let me repeat and go into a detail of what I suggested in another thread184-1818835 already:
myself said:
The usual solution using a barcode scanner is programming a prefix the scanner sends before the barcode, the prefix will set focus to the product code textbox.
That addresses the comfort for the user. Instead of manually needing to set focus to a textbox to receive the barcode or RFID code, scanners often allow to program a prefix hotkey combination like CTRL+B for barcode or anything, look into the scanner manual as programming them - if possible - can differ a lot but mostly is done by scanning some special programming codes, which are printed in the manual. Well, and always read a manual of a device, it's mostly not just about warranty and things obvious to you, it contains valuable information.
Here's the deal about such a prefix, aka preamble: In VFP you can make the caption of a label be "\<Barcode:" - the essential thing here is the "\<B" combination, that's backslash lower-than and a letter. Which will cause ALT+B to set focus to the control next in TabIndex order. If the label has its Tabindex property set to 1, it will set focus to the control with Tabindex set to 2. And that can be the textbox receiving the barcode or RFID code.
So no matter which control currently has the focus in your application, as long as the active form is having such a label and the scanner is programmed to send ALT+B followed by the barcode or RFID code, that will first set focus to the input control and then it can receive the scanned data. That's the way I did it in one system. It could also be done with a function key and you could program ON KEY LABEL F5 _screen.activeform.txtBarcode.Setfocus() or something similar. IF the scanner only allows a function key preamble, that would be usable for a FoxPro application. to make the function key direct the following input to a specific control.
This is all a bit complicated, and your scanner might not allow to program it that way, but it's worth it, if it can be done, as now users won't need to think about setting focus to the right box in your form everytime they scan something that is automatic. And so as in any supermarket they can mainly concentrate on scanning all the barcodes or RFIDs.
It's also worth mentioning you can set a form property KeyPreview to .T., which will cause any keyboard input, no matter if there's no ALT+B or any hotkey first, any key input, to first be processed by the form.Keypressed() event. But that's even more complex to program, as this event will not receive the scanned data in one call, it will come in key by key, one letter or digit at a time and you can't detect whether that's just a normal user using the actual keyboard or this keypress is a virtual keypress coming from the scanner. You could program code which accumulates the single key inputs into a buffer (a property "lastkeys", for example) and then see whether and when it's a code you expected, like a sequence of 13 digits in fast and direct succession, if you take into account the time of each single input, too. So this buffer could "time out". It's just a sketch of an idea to do it that way, but I'd prefer programming the scanner to send a prefix to your application which is some ALT+something combination that works with whatever other hotkeys you defined in your application menu or other forms and labels.
Chriss