I love it when I can write fewer lines of code and get something done in my applications. I love it even more if I only have to write one or two lines of user-written code to add major functionality to my applications. Here is a cool blog post by TMS Software showing you how you can add barcode scanning (QR, UPC and EAN codes) to your Delphi iOS projects using just two lines of code!!! The TMS iCL component pack provides Delphi components integrate with iOS APIs and in this case, specifically leverage the ZBar open source project.
Two lines of user-written code to add QR, UPC, EAN code scanning in iOS Delphi applications
Here is the code listed in the blog post:
procedure TForm1136.Button1Click(Sender: TObject); begin // line1: activate the code scanner. This shows the camera that should be aimed at the QR or UPC TMSFMXZBarReader1.Show; end; procedure TForm1136.TMSFMXZBarReader1GetResult(Sender: TObject; AResult: string); begin //line 2: the OnGetResult event is triggered when the code was retrieved and this returns it as a text ListBox1.Items.Insert(0, AResult); end;
The blog post also lists a link to the sample project code - http://www.tmssoftware.net/public/TMSFMXZBarReaderPkgDXE5.zip
I love it! Way to go TMS Software, one our premier Embarcadero Technology Partners!