If you use the OnEncode event handle to encode the barcode text in your own encoding scheme, the event occurs if there is any invalid character in the value of Barcode property or Barcode parameter:
When the Clear, Draw, Size, DrawTo (syntax 1), DrawToSize (syntax 1), Print (syntax 1), or PrintSize (syntax 1) method is called or a component is updating its barcode symbol, the event occurs if there is any invalid character in the value of Barcode property.
When the DrawTo (syntax 2), DrawToSize (syntax 2), Print (syntax 2), PrintSize (syntax 2), GetParity (syntax 1) (only for TBarcodeFmx2D_QRCode), GetCheckSum (syntax 1) (only for TBarcodeFmx2D_PDF417), or GetCheckSum (syntax 1) (only for TBarcodeFmx2D_MicroPDF417) method is called, the event occurs if there is any invalid character in the value of their Barcode parameter.
type
{ Defined in the pfmxCore2D unit }
TParseBarcodeIndex = function (Sender: TObject; Barcode: string; EncodedData: TBytes; InvalidEncodedDataIndex: Integer): Integer of object;
property ParseBarcodeIndex: TParseBarcodeIndex;
Sender: TObject; It is the object whose event handler is called.
Barcode: String; It is the barcode text in string type (it's an UnicodeString).
Its value is equal to the Barcode property if the Clear, Draw, Size, DrawTo (syntax 1), DrawToSize (syntax 1), Print (syntax 1), or PrintSize (syntax 1) method is called or a component is updating its barcode symbol. And the value of the parameter is equal to the Barcode parameter if the DrawTo (syntax 2), DrawToSize (syntax 2), Print (syntax 2), PrintSize (syntax 2), GetParity (syntax 1) (only for TBarcodeFmx2D_QRCode), GetCheckSum (syntax 1) (only for TBarcodeFmx2D_PDF417), or GetCheckSum (syntax 1) (only for TBarcodeFmx2D_MicroPDF417) method is called.
EncodedData: TBytes; The barcode text that's encoded by your own encoding scheme. It's equla the Data parameter value of the OnEncode event handle.
InvalidEncodedDataIndex: Integer; The index position of first invalid byte in the value of EncodedData parameter above. The index 0 denotes that the first byte value is invalid byte.
The index position of first invalid character in the value of Barcode parameter above should be returned. Please calculate it according to the values of EncodedData and InvalidEncodedDataIndex parameters above, and the encoding algorithm in your OnEncode event handle.
If the invalid byte value is in the prefix codes (for example the BOM), please return the value Verify_InvalidIndex_BeforeBarcode (-3). If the invalid byte value is in the suffix codes, please return the value Verify_InvalidIndex_AfterBarcode (-4). These consts are defined in the pfmxCore2D unit.
The event handle is not required if the value of Index parameter is correct in the OnInvalidChar event handle.