Scan one or more barcodes using the camera on device.

Properties

ScanMultiple

A boolean value that indicates whether accept multiple barcode entries or just scan a single barcode.

AllowDuplicates

A boolean value that indicates if duplicate barcode entries are allowed. Only applicable if ScanMultiple is set to True.

ScannerEngine

A enum value that specifies the barcode processing engine. There are 3 valid options: Default, System (for iOS only), Google.

Methods

AddBarcodeType

Add a barcode scanner type.

RemoveBarcodeType

Remove a barcode scanner type.

ClearBarcodeTypes

Clear the current list of barcode scanner types.

ActivateScanner

Activate the scanner.

GetScannedValue

Get the scanned value. Call this method in Completed event to get scanned barcode value.

Events

Completed

Triggered when barcode scanning is finished.

Code Examples

    Define_Com Class(#xDeviceBarcodeScanner) Name(#BarcodeScanner) 

Evtroutine Handling(#COM_OWNER.Initialize)  
Clr_List Named(#BarcodeTypes)  
#STD_TEXTS := 'upca'  
Add_Entry To_List(#BarcodeTypes)  
#STD_TEXTS := 'code128'  
Add_Entry To_List(#BarcodeTypes)  
#STD_TEXTS := 'qrcode'  
Add_Entry To_List(#BarcodeTypes)  
#STD_TEXTS := 'code39'  
Add_Entry To_List(#BarcodeTypes)  
#STD_TEXTS := 'itf14'  
Add_Entry To_List(#BarcodeTypes)  
#Scanner.Enabled := false
Endroutine

Evtroutine Handling(#BarcodeScanner.Initialize)  
#Scanner.Enabled := true
Endroutine

Evtroutine Handling(#Scanner.Click)  
Define Field(#vrccItemCount) Type(*INT)  
Define Field(#vrccIx) Type(*INT)  

#BarcodeScanner.ScanMultiple := (#ScanMultiple.ButtonState = Checked)  
#BarcodeScanner.AllowDuplicates := (#AllowDuplicates.ButtonState = Checked)  

#BarcodeScanner.ClearBarcodeTypes()
For Each(#item) In(#BarcodeTypes.Items)   
If (#item.Checked = Checked)      
Get_Entry Number(#item.Entry) From_List(#BarcodeTypes)     
#BarcodeScanner.AddBarcodeType( #STD_TEXTS )    
Endif  
Endfor  

#BarcodeScanner.ActivateScanner()
Endroutine

Evtroutine Handling(#BarcodeScanner.Completed) Status(#lStatus) Barcodecount(#lCount) Message(#lMessage)  
Define Field(#vrbcIx) Type(*INT)

If (#lStatus = OK)    
Begin_Loop Using(#vrbcIx) From(0) To(#lCount - 1)      
#STD_TEXTL := #BarcodeScanner.GetScannedValue( #vrbcIx )     
Add_Entry To_List(#ScannedValues)    
End_Loop  
Endif
Endroutine