Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use qr code reader? 2

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
578
PH
Hi everyone, my application work with rfid reader, then bought a qr code reader that could also reader an rfid… my problem is, the qr code reader never stops to beep and doesnt display anything… but when i use note pad and trying to tap the rfid it shows number (expected) my question is… is there something that i have to put in my code so the qr code reader reads the rfid? Thanks in advance… godbless…
 
If it works in notepad, it works as a keyboard.

You have to focus a textbox or editbox to "read in" the output of the qr/rfid scanner, as the scanner acts as a keyboard.

Just remember what Tom and I teached you in your thread184-1818443.

Chriss
 
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
 
Of course, the idea of labels with ome sort of "\<Y" caption works without a scanner, too. at allows setting focus by ALT+Y (in this case) and in general this and other keyboard mechanisms VFP offers can make an application usable without a mouse.

I know in a POS system users most often even have neither mouse nor keyboard, that's not making hotkeys a thing you think about automatically. But keep in mind scanners are acting as HID (humin input device) aka as a virtual keyboard and they can trigger hotkey behaviour, too, if programmed for it.

Chriss
 
Ok Chriss... Thanks... I'll try to figure it out using your suggestions....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top