Property: MaxSegments


Specifies the maximum number of segments for a Compact Matrix barcode symbol.



{ Defined in the pCompactMatrix unit }

TCompactMatrix_Segments = 1..32;

property MaxSegments: TCompactMatrix_Segments;


In horizontal orientation, each Compact Matrix symbol consists of an array of segments with a minimum of 1 segment (maximum 32 segments). The property specifies the maximum number of segments for a Compact Matrix barcode symbol. It can be one of values from 1 to 32, they are defined in the pCompactMatrix unit.

The maximum number of segments together with the maximum version (specified by the MaxVersion property) indicates the maximum symbol size for a Compact Matrix barcode symbol. And the minimum number of segments (specified by the MinSegments property) together with the minimum version (specified by the MinVersion property) indicates the minimum symbol size for the Compact Matrix barcode symbol. Based on the stretch order (specified by the StretchOrder property), the smallest symbol size that accommodates the barcode text will be automatically selected between the minimum symbol size and the maximum symbol size.

If the barcode text is so long that it cannot be encoded using the maximum symbol size, an OnInvalidLength (the barcode text is specified in the Barcode property) or an OnInvalidDataLength (only for Delphi/C++ Builder 2009 or later, and the barcode text is specified in the Data property) event will occur.

The CurrentSegments property can be used to get the factual number of segments.

Note, if the property is set to a value less than the MinSegments property's value, the MinSegments property will be automatically changed to equal to this property's value. In other words, the MaxSegments property's value is always greater than or equal to the MinSegments property's value.

See also the "Symbol sizes" section in the "TBarcode2D_CompactMatrix" article.