Barcode Scanner vs. TextBox's OnChange

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Posts: 361
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 102 times
Been thanked: 262 times

Re: Barcode Scanner vs. TextBox's OnChange

Post by edk » Fri Aug 24, 2018 6:10 am

Roberto Lopez wrote:
Sun Aug 19, 2018 2:19 pm
Apparently, when the data comes from the scanner, it generates ONLY ONE OnChange event.
Perhaps when you program a barcode reader to make longer delays when sending characters to the keyboard buffer, then subsequent OnChange events will appear.

Posts: 126
Joined: Sun Mar 21, 2010 5:45 pm
Has thanked: 6 times
Been thanked: 36 times

Post by PeteWG » Fri Aug 24, 2018 10:08 am

Roberto Lopez wrote:
Thu Aug 23, 2018 11:07 pm
I've wrote "defensive code" against this possibility, so is not a problem for me, but, I'm simply curious about that :)
I had no doubt you would securing your code against the possibility of two identical bar-codes. ;-)

And like you, curiosity was the "attractor" of my interference in this thread.

I'm using b-codes years now, in a pos app, that's written in harbour textual interface -now slowly transforming it to gui.
I have never encountered such a case of duplicate b-codes in whatever system (EAN-xxx etc) they might be coded.
To the contrary, what I have faced is the situation where the very SAME product has many different bar-codes!!
This is due to the need to cover the different sizes/colors of the same item --usually seen on clothes/shoes etc.
(Anyway, somehow I did manage to cope with it, avoiding the need to create multiple of records for the same item.)

Roberto Lopez wrote:
Thu Aug 23, 2018 11:07 pm
I've googled it without luck.
Indeed, google has no much to say us about identical b-codes, and perhaps this lack of info is analogous
to the probability that such duplicate bar-codes do exist. Luckily, the world isn't currently bothered by yet another one IT mess. :)

Btw, I suspect that reason the `onChange` event is fired only once, is because scanner sends along with the barcode an `Enter` as a suffix of the digits sequence. Perhaps, the use of `onEnter` event could be considered a good alternative to avoid repeated firing on keybord input, unless it is intentionally designed and aimed to do so.


User avatar
Posts: 522
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Has thanked: 145 times
Been thanked: 13 times

Post by quartz565 » Fri Aug 24, 2018 10:20 am

Hi Roberto,
Try to change the textbox from onghange to onenter and programming the scanner to send with EAN and the ENTER together. This will bring the entire information to the textbox from the scanner before you start Search.
Best Regards,

os: Windows Server 2012 - 64
hw: HP Server E5606, 2.13GHz, 8.00 GB - Intel Xeon CPU

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Sat Aug 25, 2018 10:42 pm

dragancesu wrote:
Fri Aug 24, 2018 4:03 am
What is the type, model?
This will be difficult (or impossible to say) since the scanner comes from an Argentinian dealer that "rebrands" with its name, imported products, so, there is no way to me to answer that.


(Veritas Filia Temporis)

Posts: 296
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Sun Aug 26, 2018 9:51 pm

I am not sure if this is what you need but when I print a barcode in (font free 3 of 9 extended ) I must put a '*' at start and '* ' at end after
alltrimming the variable or field. Maybe you need to remove the * if it happens to be in the barcode.
This may have something to do with it.
Franco Bushie

User avatar
Roberto Lopez
HMG Founder
Posts: 3919
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 15 times
Been thanked: 140 times

Post by Roberto Lopez » Mon Aug 27, 2018 12:08 am

At first... thanks to all for your answers and suggestions. I've was near to no post about this, since I've believed that could be not enough interest on this topic :D

As I've said, the "thing" was working nicely at the time of my initial post, so, It was just about my curiosity around it.

I've found my own answer to the mystery: It appears to be all about timing (time elapsed between keystrokes).

It is very easy to test:

Code: Select all

		@ 10,10 TEXTBOX Text_1 ;
You simply must to keep pressed some key and let the auto-repeat feature do the rest, At first, you'll ear a single beep, then (when the auto-repeat starts) no more beeps will be generated, until you stop pressing the key.

Since the barcode scanner is sending the "keystrokes" very fast (the same as auto-repeat) a single OnChange event is generated.

Mystery Solved! 8-)

Again... thanks to all for the feedback.

PS: I guess that the timing thing on EN_CHANGE Windows event, is known and (maybe) documented in some Windows programming "bible"... Some Guru outhere ?


(Veritas Filia Temporis)

User avatar
Posts: 2087
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 114 times
Been thanked: 15 times

Post by danielmaximiliano » Fri Oct 19, 2018 11:08 pm

Hola Roberto, estoy muy ausente en el foro, resolvió el problema sobre EAN 13 \ EAN 8
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !

Saludos / Regards

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

Post Reply