14.6.6 xDeviceBarcodeScanner Widget

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.

Name

Type

Mandatory

Description

Type

Enum

Yes

Supported barcode type of each scanner engine.

Default:

UPCA, CODE128, QRCODE, CODE39, ITF14, CODABAR, UPCE, CODE93

Google:

UPCA, CODE128, QRCODE, CODE39, ITF14, CODABAR, UPCE, CODE93, DATAMATRIX, PDF417, AZTEK

System:

UPCA, CODE128, QRCODE, CODE39, ITF14, UPCE, CODE93, DATAMATRIX, PDF417, AZTEK

 

RemoveBarcodeType

Remove a barcode scanner type.

Name

Type

Mandatory

Description

Type

Enum

Yes

Valid values are: UPCA, CODE128, QRCODE, CODE39, ITF14, CODABAR, UPCE, CODE93, DATAMATRIX, PDF417, AZTEK

 

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.

Name

Type

Mandatory

Description

Index

Integer

Yes

Specify an index to locate a barcode value in scanned value list.

 

Events

Completed

Triggered when barcode scanning is finished.

Name

Type

Description

Status

Enum

See Status Code

BarcodeCount

Integer

The number of barcodes that were scanned

Message

String

 

 

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