Barcode Scanner vs. TextBox's OnChange
Moderator: Rathinagiri
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Barcode Scanner vs. TextBox's OnChange
Hi All,
This is an interesting thing for those working with barcode scanners on HMG.
An app, I'm developed for one of my customers, read product codes (EAN-13) from a barcode scanner.
To make the process fully automatic, I'm using OnChange event (in a textbox that always has the focus).
Inside OnChange event, I ask for the length of the textbox content, If 13, I search for it in a table.
Very simple.
Some days ago, this customer informed me, that some new codes are not working. These new codes are EAN-8.
Then, I've modified my OnChange event to support both codes.
But, while testing, I've noticed that the behavior of my code is different according how the data is entered (code digits manually by keyboard or using the barcode scanner).
Apparently, when the data comes from the scanner, it generates ONLY ONE OnChange event.
Someone has experience with this?
This happen always with all barcode scanners?
Does someone knows how the scanner works / Why is generating only one OnChange event?
TIA.
PS: If someone is surprised because this question comes from me... well... HMG only makes use of WIN32API EN_CHANGE event message, so, all this thing, happens between the barcode scanner and Windows... so... is "their" thing
This is an interesting thing for those working with barcode scanners on HMG.
An app, I'm developed for one of my customers, read product codes (EAN-13) from a barcode scanner.
To make the process fully automatic, I'm using OnChange event (in a textbox that always has the focus).
Inside OnChange event, I ask for the length of the textbox content, If 13, I search for it in a table.
Very simple.
Some days ago, this customer informed me, that some new codes are not working. These new codes are EAN-8.
Then, I've modified my OnChange event to support both codes.
But, while testing, I've noticed that the behavior of my code is different according how the data is entered (code digits manually by keyboard or using the barcode scanner).
Apparently, when the data comes from the scanner, it generates ONLY ONE OnChange event.
Someone has experience with this?
This happen always with all barcode scanners?
Does someone knows how the scanner works / Why is generating only one OnChange event?
TIA.
PS: If someone is surprised because this question comes from me... well... HMG only makes use of WIN32API EN_CHANGE event message, so, all this thing, happens between the barcode scanner and Windows... so... is "their" thing
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Barcode Scanner vs. TextBox's OnChange
Welcome back Roberto!
I had also experienced this Roberto. I have seen that the barcode scanning is not like a keyboard event. It is like a Copy/Paste event. So, when somebody scans the code while the focus is in a textbox, all the characters are entered at once. I think that's why only one onchange event is fired.
I had also experienced this Roberto. I have seen that the barcode scanning is not like a keyboard event. It is like a Copy/Paste event. So, when somebody scans the code while the focus is in a textbox, all the characters are entered at once. I think that's why only one onchange event is fired.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Barcode Scanner vs. TextBox's OnChange
I've took a "forced" vacation from the forum (a lot of work... almost no spare time!)
Is "tranquilizing" for me to know that this happened to someone elseRathinagiri wrote: ↑Sun Aug 19, 2018 2:32 pm I had also experienced this Roberto. I have seen that the barcode scanning is not like a keyboard event. It is like a Copy/Paste event. So, when somebody scans the code while the focus is in a textbox, all the characters are entered at once. I think that's why only one onchange event is fired.
Yes... indeed it works exactly like a paste operation.
Now... One a little more difficult: There is some possibility that the first 8 digits of an EAN-13 code product, be exactly the same as all the (8) digits for another (EAN-8) product? (I'm talking about codes internationally awared).
TIA.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Barcode Scanner vs. TextBox's OnChange
I think it is not possible, as these codes are omnidiretional, meaning they can be read from any direction (left to right and right to left). IMHO, your situation won't arise.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Barcode Scanner vs. TextBox's OnChange
Thanks!Rathinagiri wrote: ↑Sun Aug 19, 2018 3:48 pm I think it is not possible, as these codes are omnidiretional, meaning they can be read from any direction (left to right and right to left). IMHO, your situation won't arise.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Barcode Scanner vs. TextBox's OnChange
Roberto Lopez wrote: ↑Sun Aug 19, 2018 3:04 pm Now... One a little more difficult: There is some possibility that the first 8 digits of an EAN-13 code product, be exactly the same as all the (8) digits for another (EAN-8) product? (I'm talking about codes internationally awared).
Rarthi,Rathinagiri wrote: ↑Sun Aug 19, 2018 3:48 pm I think it is not possible, as these codes are omnidiretional, meaning they can be read from any direction (left to right and right to left). IMHO, your situation won't arise.
I'd be really grateful if you'd kindly want to explain a little why this "omnidiretional" reading capability, forbids two codes (EAN-8 & EAN-13) to be the same. (eight first digits).
I ask this because the codes:
90311017 (EAN-8)
9031101712340 (EAN-13)
seems to be valid barcodes, while their digits perfectly match (compared left to right).
But I'm not qualified enough to say wether they're "internationally awared" or not;
I just motivated by the plausible (to me) answer "why not" to the question: "There is some possibility that the first 8 digits of an EAN-13 code product, be exactly the same as all the (8) digits for another (EAN-8) product?"
regards,
Pete
Re: Barcode Scanner vs. TextBox's OnChange
Hi Pete!
EAN Codes are provided from national code organisation.
The organization is watching that the codes are unique.
User can make own codes from range 20 to 29 (first two digist).
In other cases, firs digits represent country of producer (sometimes not - like Coca Cola, but it's rarely).
Your codes can be right, but it doesn't mean they appear on products
EAN Codes are provided from national code organisation.
The organization is watching that the codes are unique.
User can make own codes from range 20 to 29 (first two digist).
In other cases, firs digits represent country of producer (sometimes not - like Coca Cola, but it's rarely).
Your codes can be right, but it doesn't mean they appear on products
Last edited by mol on Sun Oct 21, 2018 10:09 am, edited 1 time in total.
Re: Barcode Scanner vs. TextBox's OnChange
Hi Mol,
thanks for the info offered!
and of course, you are right about the uniqueness of codes that are issued by national and international supervising authorities;
otherwise, bar-codes technology would be nearly useless for articles identification and chaos would prevailing
in global trading and distribution of goods.
However, what I was curious and then trying to clarify and hopefully get some info (from Rathi and from you
or anybody else who might know about) is the "possibility that the first 8 digits of an EAN-13 code product,
be exactly the same as all the (8) digits for another (EAN-8) product", that is, the question that asked by Roberto.
Still I think the answer is:
Yes, technically there is such a possibility, two (valid) bar-codes being the same.
Is this probable to happen in the real "barcoded" world?
I don't really know... maybe not!
(and when "don't know" is a good reason to seek for info and / or experience on the matter).
regards,
Pete
thanks for the info offered!
and of course, you are right about the uniqueness of codes that are issued by national and international supervising authorities;
otherwise, bar-codes technology would be nearly useless for articles identification and chaos would prevailing
in global trading and distribution of goods.
However, what I was curious and then trying to clarify and hopefully get some info (from Rathi and from you
or anybody else who might know about) is the "possibility that the first 8 digits of an EAN-13 code product,
be exactly the same as all the (8) digits for another (EAN-8) product", that is, the question that asked by Roberto.
Still I think the answer is:
Yes, technically there is such a possibility, two (valid) bar-codes being the same.
Is this probable to happen in the real "barcoded" world?
I don't really know... maybe not!
(and when "don't know" is a good reason to seek for info and / or experience on the matter).
regards,
Pete
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Barcode Scanner vs. TextBox's OnChange
I've wrote "defensive code" against this possibility, so is not a problem for me, but, I'm simply curious about thatPeteWG wrote: ↑Tue Aug 21, 2018 6:04 am Yes, technically there is such a possibility, two (valid) bar-codes being the same.
Is this probable to happen in the real "barcoded" world?
I don't really know... maybe not!
(and when "don't know" is a good reason to seek for info and / or experience on the matter).
I've googled it without luck.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: Barcode Scanner vs. TextBox's OnChange
What is the type, model?
The barcode scanner can be "programmed", which codes to accept, whether to send the code enter at the end,the sequencing programs are bar codes, usually in booklet with the device
The barcode scanner can be "programmed", which codes to accept, whether to send the code enter at the end,the sequencing programs are bar codes, usually in booklet with the device