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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling BarCode Scanner 1

Status
Not open for further replies.

Raccoon

Programmer
Aug 18, 1999
92
US
I have an application with many objects on any given page. I also have a wedge barcode scanner attached inline with my keyboard.

The problem is I can find no way to tell if input is coming from scanner or keyboard. When coming from scanner, it might not correspond to the object the cursor is at.

Should I put code in all objects on the page to check input for some special char sequence embedded in each barcode? Or does someone have a "elegant" way of handeling this?

Mike
 
I don't see where you have any other choice. Since the scanner is just stuffing the keyboard buffer, the app won't know where the input is coming from unless you tell it.

Dave S.
 
You could program a "F" key to set focus on the appropriate textbox, when you are ready to scan.
 
Thank you mgagnon, I never would have thought of it. (Should have but that's what happens when you get old.)
 
We have a similar scanner setup, we the user enter product description and quantity etc.. and needs to re-focus on the part number field before he scans.
 
I'm having trouble getting it to work. What syntax do you use for the set function command, ie:

set function 6 = "thisform.cmdSample.setfocus"

What did I miss?

Getting old is tough, but it's better than the other option :)
 
[red]
set function 6 = "thisform.cmdSample.setfocus"
[/red]

One way of doing it is in your main program put:

Code:
ON KEY LABEL F2 DO FOCUS
PUBLIC oForm1
PROCEDURE FOCUS
   oForm1.text2.setfocus()
ENDPROC

And when you call for the form use;

Code:
DO FORM myform.scx NAME oForm1

Use the NAME parameter

 
I would be wary of doing it this way. Pressing F2 if the form isn't open can cause problems. I use the form's KEYPRESS event to do this:
[tt]
LPARAMETERS nKeyCode,nShiftAltCtrl
IF nKeyCode=-1 && F2
NODEFAULT
Thisform.Text2.SetFocus()
ENDIF
[/tt]
Two notes on the above code:

1) The NODEFAULT is in there to prevent the funny Ÿ character from appearing in the current control.

2) You need to set the form's KEYPREVIEW property to .T.

Ian
 
You are right Racoon, unless you PUSH KEY and POP Key at the appropriate places.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top