revUp - Updates and news for the Revolution community
Issue 127 | January 27th 2012 Contact the Editor | How to Contribute

MergZXing: Barcode Reader
We know lots of you have been waiting for this to become available, now its here in LiveCode Marketplace

by Monte Goulding

We're delighted to welcome mergZXing to the LiveCode Marketplace. This valuable external for iOS and Android will allow you to add barcode reading functionality to your app.

mergZXing is a LiveCode external that uses ZXing library to read barcodes via the back camera of a mobile device. Because of the need for the external to use the back camera of the device it does not function in the simulator. The external supports iOS 4 and up and devices with an autofocus camera (iPhone 3GS and up). Devices without autofocus may scan under certain conditions with better performance on 2D codes (QR, DataMatrix).

mergXzing

mergZXing contains ZXing 1.7 (pronounced “zebra crossing”) which is an open-source, multi-format 1D/2D barcode image processing library. For more information about complying with this license please refer to the License Questions page on the ZXing wiki.

mergZXing currently supports reading barcodes in these formats:

  • UPC-A and UPC-E
  • EAN-8 and EAN-13
  • Code 39
  • Code 128
  • QR Code
  • ITF
  • Data Matrix

mergZXing Syntax

function mergZXingGetBarcode()

Syntax example:

put mergZXingGetBarcode() into tBarcode

Presents a modal barcode reader and returns when a barcode is read or the user cancels.

Returns:

  • The read barcode
  • If the user touches up on the cancel button the function will return “mergBarcode: user cancelled”
  • If there is a barcode reader control already on screen then the function will return “mergZXing:Error: control already created”

command mergZXingControlCreate pLeft,pTop,pRight,pBottom

Syntax example:

mergZXingControlCreate 0,0,the width of this stack,the height \
       of this stack div 2

Displays a barcode reader control in the rect specified.

Results:

  • If successful then the result is set to mergZXing: control created
  • If there is a barcode reader control already on screen then the result is set to “mergZXing:Error: control already created”

command mergZXingControlSetRect pLeft,pTop,pRight,pBottom

Syntax example:

mergZXingControlSetRect 0,0,the width of this stack,the height \
       of this stack div 2

Alters the rect of an existing barcode reader control.

Results:

  • If successful then the result is set to “mergZXing: control rect set”
  • If there is not a barcode reader control already on screen then the result is set to “mergZXing:Error: control not created yet”

command mergZXingControlDelete

Syntax example:

mergZXingControlDelete

Removes an existing barcode reader control from screen.

Results:

  • If successful then the result is set to “mergZXing: control deleted”
  • If there is not a barcode reader control already on screen then the result is set to “mergZXing:Error: control not created yet”

message mergZXingDidScanResult pBarcode

Syntax example:

on mergZXingDidScanResult pBarcode
     answer pBarcode
end mergZXingDidScanResult

Sent to the default card when a barcode is scanned using the mergZXing control.

Building your app with mergZXing

Follow these steps:

  • Open the Standalone Application Settings for your app
  • Browse to the Copy Files pane
  • Click on Add Folder and choose the External folder from your hard drive
  • Save and Build your app as a standalone

mergXZing can be purchased here.

Mark

About the Author

Monte Goulding is an experienced LiveCode developer with a consulting business in vertical markets.

 

 

 

Main Menu

What's New

Sign up to the Game Academy