Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Scanning in a readonly Field 1

Status
Not open for further replies.

Admigha

IS-IT--Management
Aug 22, 2007
21
CA
Hi,
I'm using a form with some readonly fields and Grids,
One input field is used to receive barcode scanning.
Some times the user gets focus on the Grid, and without returning to the INPUT Field, he starts to scan, which leads to a sequence of beeps.
Is there a way to trigger the scanning outside the Input Field?


Tony Lama
Admigha SoftHouse
 
"Prevent Scanning in a readonly Field"

"Is there a way to trigger the scanning outside the Input Field?"

I don't know about the others, but I am confused by what you want to do.

"Scanning" is moving from record to record through a data table - generally following some SCAN/ENDSCAN criteria. It has nothing to do with the Fields themselves.

You can Browse a table in a Grid and you can set individual Fields in that Grid to be ReadOnly or just not include them for display in the Grid at all.

But you also ask about 'trigger the scan' ??
What do you mean?

With some better clarification, we can most likely provide you with better answers.

Good Luck,
JRB-Bldr

 
JRB-Bldr:
"One input field is used to receive barcode scanning."

Bar code scanners basically replace keyboard input. So you're going to have to think of it as a extension to the keyboard and handle input, lostfocus, getfocus, ... events as though the user would be typing the values in manually.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
That's what is happining, but in some case the user gets to a grid to scroll or to view extra data, in this case it is difficult to know when the barcode is starting again, I have to know that is typing (scanning) in a protected field, This trigger is the question.

Tony Lama
Admigha SoftHouse
 
Tony,

So, you're saying that the user scrolls the grid, this removing focus from the barcode input box. Then, when they start scanning, focus is still in the grid, so the grid tries to receive the barcode, which is obviously not what you want.

Have I understood that right?

If so, a solution might be to write code in the grid's Scrolled event, which is called after the grid has been scrolled. The code would set focus back to the text box.

Frankly, I don't know whether or not that would work, but it would definitely be worth experimenting with.

If it does work, you would also have to do something similar in the grid's Keypress event, in case the user uses the cursor keys to scroll.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yes Mike, this is what I needed, and It works for the scroll, and the other controls I put a timer that turns back the focus to the input field, it is not solid solution, but it works.
Thank you Mike.

Tony Lama
Admigha SoftHouse
 
If ALL keyboard input should be interpreted as "scanning in progress" then set the form's KeyPreview = .t. and in KeyPress call the input control's SetFocus().

You may need to use KeyPress to detect keys like directional keys and NOT redirect focus so that users can still scroll around in the grid but that's easy enough.
 
Keypress in conjunction with KeyPreview is a good idea, but you'd still need to determine which keypresses come from the barcode scanner. Fast input can be interpreted as scanner input, but you only know so after the second barcode digit arrives.

I also had the same problem and we could program all barcode scanners to send an additional key (in our case F8), so the scanner itself was sending F8+barcode digits.

Form.Keypreview is set to .T. and so I can catch F8 in the Keypress Event of the form no matter where the focus is. If KeyPress detects F8 the focus is set to a barcode textbox. The rest of the barcode then arrives into that barcode textbox.

If you can program your scanner with such a feature, that solution works very well.

Bye, Olaf.
 
Good idea Olaf.
I use a barcode scanner for a couple apps in my company and the scanners are able to add a carriage return at the end of their string, but I have always coded the form to set focus to the scanned data input box.
Having the app look for a particular key to determine scanners instead of the keyboard is being used seems more intuitive.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thank you Olaf, it seems to be a good idea, I will try my scanner if it sends a Function key.

Tony Lama
Admigha SoftHouse
 
Yes Dave,

a Return after the barcode is also good idea. In my case it´s constant length EAN12 Barcodes, so after 12 digits I know the barcode is fully scanned in and I can use this via Maxlength and SET CONFIRM OFF to get into validate of the barcode textbox automatically.

But there are other types of barcodes, so a return after the barcode is a plus.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top