Hi Scott,
Have a look at the keypressed() method in a form that processes bar code input.
It works (most of the time :)). I did have to calm down the scanner a bit so that it would wait a few milliseconds between characters sent.
LPARAMETERS nkeycode,nshiftaltctrl
LOCAL c
c= chr(nKeycode)
*-- de is a "data environment" object (read really a library of routines and
*-- properties specific to the current form)
*-- the string read from the barcode is compiled into this.de.cBarcode
*-- this.de.lBarcodeReading is a flag to set barcode reading. (Simple keyboard
*-- input is processed as well, if c $ hRoomKeyenum).
*-- is this a barcode input?
if !(c $ hRoomKeyEnum) and !this.de.lBarcodeReading
*-- set barcode reading on
this.de.lBarcodeReading= .t.
*-- initiate the compile string and save the character
this.de.cBarcode= c
nodefault
return
endif
if this.de.lBarcodeReading
*-- barcode reading ends with a CR
if c= chr(13)
*-- deactivate barcode reading
this.de.lBarcodeReading= .f.
*-- do your thing with the compiled string
thisform.de.ProcessFixedScan()
nodefault
return
endif
*-- compile the string
this.de.cBarcode= this.de.cBarcode+c
nodefault
return
endif
*-- otherwise process keyboard imput
if c $ hRoomKeyEnum
thisform.de.keyboard(c)
nodefault
return
endif
*-- verrrrry unlikely :)
=dodefault(nKeyCode,nShiftAltCtrl)
>I can't be sure the users will scan the barcode in a specific sequence so I am looking for a way to capture the data scanned by the keyboard wedge barcode reader, store that data to determine what the data is, and then put the data in the right field. My problem is that if I use INKEY() or the KeyPress Event, I can read the first or last key in the buffer, but I lose all the keys in the middle. Any ideas on how to grab the entire keyboard buffer?
If things have the tendency to go your way, do not worry. It won't last. Jules Renard.