[Lazarus] Fw: Re: One last ask for help

Antonio Fortuny a.fortuny at sitasoftware.lu
Thu Mar 21 13:37:26 CET 2013


Hi Ricardo.

As of my last experience (Datalogic, Motorola former Symbol models, all 
using WinCE) the scanner itself needs to be very carefully configured. 
AKAIK in all models I've tested, the barcode scanner sends the chars as 
if they were typed on the keyboard. Because of this it is difficult to 
distinguish the source: the scanner or the keyboard.
That's why I have setup the scanner to send a prefix and a suffix whith 
the barcode itself. I use the STX and ETX special characters.
In my applications the barcode itself is gathered silently because it 
has no meaning for the user but it is sometimes displayed in a TLabel.
Anyway, in all cases I use the KeyPreview event of the form. If I get 
the STX all next characters are stored in a barcode string until the EOT 
is catched otherwise they follow the standard process and are caught by 
the focused control. This way I can mix, in the application, input 
coming from the KB (quantities, weights, etc.) and from the scanner.

To have the characters sent by the scanner into an edit field, the edit 
field must have the focus otherwise either the characters are lost (no 
input fields capable of input) or they go into a misfocused control. Do 
not forget (see scanner config) that usually the scanner sends a CR+LF 
(or only LF) after the last character of the scanning process. So focus 
may change too.

Antonio.





More information about the Lazarus mailing list