If you want to use a USB barcode scanner and still have complete control, you 
can use ON EVENT CALL to manage this. You'll need to program a prefix character 
and a suffix character into the barcode scanner, and have your ON EVENT CALL 
method watch for these characters to determine what to do.

For example, if you scan the text 123, and your barcode prefix character is 
<STX> and the suffix character is <ETX>, the stream passed to 4D will look like 
this:

<STX>123<ETX>

So - for those forms where you want to process a barcode, you install an ON 
EVENT CALL method that's waiting for an <STX> keypress event. When it sees one, 
it starts collecting the subsequent characters into a text variable (and 
filtering them from the event stream that would otherwise pass those characters 
to the form) until it sees an <ETX>.

When it sees an <ETX>, it stops collecting characters and then passes the 
buffer of what it collected back to the form (CALL FORM or CALL PROCESS if 
you're on an older version of 4D).

It's a fair amount of code and it takes awhile to shake out all the bugs, but 
it gives you complete control over the barcode scanner.

Jeff

On Oct 15, 2019, at 7:25 PM, Peter Jakobsson via 4d_tech@lists.4d.com> wrote:

> Was wondering what technique people used for capturing scans into 4D. At
> the moment I’m using a simple text field and the scanner simply ‘pastes’
> the code into the text field, but something a bit more sophisticated is
> called for ideally where a scan can be “detected” by the 4D form even
> though no text field may be present. (e.g. as one of a number of possible
> form actions or as an alternative to a manual lookup of the product).

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to