Archive<< September 2020 >>
- TMS FNC UI Pack v3.2 Revealing some highly anticipated components
- Hands-on: Building web design for a RAD Studio TMS WEB Core project
- TMS WEB Core Academic is here for Delphi developers!
- Get started with TMS WEB Core for Visual Studio Code
- Online event: The Theory and Practice of Amazing Desktop Application UI & UX
- TMS FNC Maps updates!
- TMS Subscription Manager v2.1 released
- Documenting your Delphi REST API the easy way
- TMS WEB Core for Visual Studio Code v1.0 released
- Edge Chromium Stable Support!
- Adrian Gallero (22)
- Bart Holvoet (5)
- Bernard Roussely (1)
- Bruno Fierens (261)
- Gjalt Vanhouwaert (6)
- Holger Flick (15)
- Marcos Douglas B. Santos (5)
- Masiha Zemarai (51)
- Nancy Lescouhier (32)
- Pieter Scheldeman (35)
- Roman Yankovsky (2)
- Tunde Keller (10)
- Wagner R. Landgraf (67)
BlogAll Blog Posts | Next Post | Previous Post
Friday, December 20, 2013Note on June 1, 2018:
This technique is deprecated as the zbar library is no longer maintained and does not have 64bit version. We recommend to use the native iOS barcode scanner component that is included in TMS iCL now.
For an internal project, we looked at integrating QR code scanning in an iOS application. As we didn't feel like reinventing the wheel and deal with the complexities of deciphering a QR code, we searched for existing code and after trying out several solutions, found ZBar to be one of the most solid libraries. The project is at : http://zbar.sourceforge.net/
After doing this evaluation in XCode with ObjectiveC, the next duty was to find out how we could use an ObjectiveC library from a Delphi FireMonkey project. There are several important details to pay attention to when doing this, but finally this also proved to work and in the typical Delphi RAD philosophy, we decided to create a wrapper Delphi component for this. With this wrapper component, scanning a QR, UPC or EAN code from Delphi is as simple as two lines of code:
You can download the sample project and the package with full source code to install the TTMSFMXZBarReader component here: http://www.tmssoftware.net/public/TMSFMXZBarReader.zip
procedure TForm1136.Button1Click(Sender: TObject); begin // line1: activate the code scanner. This shows the camera that should be aimed at the QR or UPC code 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;
Open the package file TMSFMXZBarReaderPkgDXE*.dproj from Delphi XE* (* = 5,6,7,8) and compile & install this package. This will add the component TTMSFMXZBarReader on the tool palette. Then you can drop this component in an iOS Delphi appplication and start using it in 1,2, 3 ...
This blog post has received 29 comments.
All Blog Posts | Next Post | Previous Post