Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 08-18-2017, 12:52 AM
Marsheng Marsheng is offline
Senior Member
 
Join Date: Nov 2008
Posts: 282
Default Reading barcodes and executing code

I have a new QR/barcode reader and it reads straight into a text field.

Once it reads a code, my PC bleeps like I had hit the carriage return button. I cannot find an associated event with this action to run the rest of the code automatically.

I'm not sure what the terminating character is, but I might have to write code to look for it.

I was hoping for a simpler event solution.

Last edited by Marsheng; 08-19-2017 at 01:34 AM.
  #2  
Old 08-18-2017, 01:01 AM
Marsheng Marsheng is offline
Senior Member
 
Join Date: Nov 2008
Posts: 282
Default

Not so simple, I read the data into a text box. I believe the terminating chars are CR and LF

However

HTML Code:
procedure TfMain.eQRChange(Sender: TObject);
begin
  if pos(#10,eQR.Text) <> 0 then
        Windows.Beep(800, 500);

end;
doesn't work as CR or LF are not stored in the edit field.
  #3  
Old 08-18-2017, 04:26 AM
Marsheng Marsheng is offline
Senior Member
 
Join Date: Nov 2008
Posts: 282
Default

Often typing a question helps the grey matter find a solution.

HTML Code:
procedure TfMain.eQRKeyPress(Sender: TObject; var Key: Char);
var
   sQR:string;
begin
   if ord(Key) = VK_RETURN then begin
      sQR := eQR.text;
      DO CODE;
   end;
end;
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 08:18 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.