If you use the Delphi/C++ Builder 2009 or later, you can use the Data property to specify a block of binary (bytes) data, and encode it into a barcode symbol, or specifies the barcode text in AnsiString format. The event occurs when the length of the Data property value is invalid.
type
{ Defined in the pBarcode2D unit }
TOnInvalidDataLength = procedure (Sender: TObject; Data: AnsiString; LinearFlag: Boolean) of object;
property OnInvalidDataLength: TOnInvalidDataLength;
Sender: TObject; It is the object whose event handler is called.
Data: AnsiString; The invalid value of the Data property.
For the TBarcode2D_CCA, TBarcode2D_CCB, and TBarcode2D_CCC 2D barcode components, if the value of the LinearFlag parameter is true, it's the Data property's value of the linear barcode component that's specified in the Linear property. Otherwise, it is the Data property's value of the 2D barcode component.
For other barcode components, it's the Data property's value of the 2D barcode component.
LinearFlag: Bolean; It denotes whether the barcode's length of the linear component is invalid in an EAN.UCC composite barcode symbol.
For the TBarcode2D_CCA, TBarcode2D_CCB, and TBarcode2D_CCC 2D barcode components, if the value of the parameter is true, it denotes the length of the Data property's value of the linear barcode component that's specified by the Linear property is invalid. Otherwise, it denotes the length of the Data property's value of the 2D barcode component is invalid.
For other barcode components, the value of the parameter is always false.
In general, it occurs when the length of barcode text exceeds the maximum length limit. For the TBarcode2D_RSSLimited, TBarcode2D_RSS14, and TBarcode2D_AztecRunes components, if the Data property value is an empty string, the event occurs too.
If the Locked property is set to false, the event occurs when any component property is changed to cause the barcode is redrew, or when the Draw, Clear, Size, DrawTo (Syntax 1), DrawToSize (Syntax 1), Print (Syntax 1), or PrintSize (Syntax 1) method is called. Even if the Image property isn't specified.
If the Locked property is set to true, the event occurs when the Locked property is set to false to cause the barcode is redrew, or the Draw, Clear, Size, DrawTo (Syntax 1), DrawToSize (Syntax 1), Print (Syntax 1), or PrintSize (Syntax 1) method is called. Even if the Image property isn't specified.
The event is available only for the Delphi/C++ Builder 2009 or later.