I'm developing a POS (pet project) and I'm thinking of adding a bar code scanner to capture the sales faster. I do not have a scanner at the moment with me, and would like to ask some questions, as I'm stuck a bit.
On the sales screen my initial idea was to have an TEdit
component and when a person scans the product it would fill the TEdit
with the string. Now the problem I'm encountering is that I want to make the TEdit
invisible so that the person does not see it. But once you make the TEdit
invisible, you cannot set focus on it, so that plan cannot work.
So can anyone suggest what I can use to "capture" the scanned string? How would I make the component to listen and wait for the scanner? I assume that the scanner would be like a normal keyboard event, like button down or up.
There's KeyPreview property on TForm. Set it to true, so all key presses are processed by form first before controls.
Article about keyboard processing in Delphi: http://delphi.about.com/od/objectpascalide/a/keyboard_events.htm
Related SO question: How does Delphi's KeyPreview work?