THPDFPage.AddComboBoxWithLabels Method
Adds a single-choice combo box whose stored export values are separate from the labels shown to the user. Each option is written as a two-element /Opt pair, so submitted values stay stable whilst the visible text can be localised or sorted independently
Declaration
procedure AddComboBoxWithLabels(const FieldName: AnsiString; const ExportValues, DisplayLabels: array of AnsiString; SelectedIndex: Integer; Rectangle: TRect; Flags: THPDFFormFieldFlags= []);
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
FieldName | AcroForm field name written to the widget dictionary |
ExportValues | Export values stored as the first element of each two-element /Opt pair; the selected value is written to the field /V entry |
DisplayLabels | Human-readable option labels stored as the second element of each /Opt pair and used for the selected-caption appearance |
SelectedIndex | Zero-based index into the option arrays that selects the stored value and /I highlight position; ignored when the arrays are empty |
Rectangle | Widget rectangle in page coordinates |
Flags | Additional THPDFFormFieldFlags written to the field /Ff entry |
Return value
This member does not return a value
Usage notes
- The field requires PDF 1.2 or later, matching AddComboBox
- ExportValues and DisplayLabels must have the same length and SelectedIndex must select one of them, or the method raises an exception; empty arrays create a field with no stored value
- Option order follows the same label-sorting rule as AddComboBox, and non-ASCII export values and labels are stored as UTF-16BE hex strings