Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to read string from serial port for bar code app
Message
From
03/05/2002 08:55:23
 
 
To
02/05/2002 20:25:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00651375
Message ID:
00652333
Views:
25
David,

Now that you've decided to use a form, create a form property to hold the input buffer, and a form method to process that input. Now, your ONCOMM event (2) can be reduced to something like:
THISFORM.MyBuffer = THISFORM.MyBuffer + THIS.input
THISFORM.ProcessData()
In ProcessData():
IF yourendoflinechar$THISFORM.MyBuffer
  * Got a complete line - Do something
  * Save it, send it, turn on a light, etc.
  THISFORM.MyBuffer = ""
ENDIF
and you are done. If there is a chance of multiple scans in the buffer, you might test for multiple End of Line chars and just extract the most recent, leaving the rest intact or processing them all, or ? It's up to you.

>OK. I think I've got the concepts down now. I can see why you have put it together the way you have, and why vfpcom is need.
>
>BTW, in this case I will probably instantiate it from a form. But I will probably need the control without a form down the road for some other uses.
>
>Thanks again!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform