THPDFPage.AddListBox

THPDFPage

 

Methods  AcroForm Support

Adds an AcroForm list box choice field to the current page

 

Delphi syntax:

procedure AddListBox(const FieldName, InitialValue: AnsiString; const Options: array of AnsiString; Rectangle: TRect; Flags: THPDFFormFieldFlags = []);

 

Description

The method creates a /Ch field without the Combo flag. Use ffMultiSelect in Flags when the viewer should allow more than one option to be selected

AutoFormAppearances is on by default, so generated listbox appearances paint the stored option strings in their saved order inside the widget clip and highlight the first option matching a nonempty InitialValue; an absent, empty, or unmatched value does not create a selected row

The current API accepts simple option strings and one initial scalar value; ffMultiSelect lets the viewer make additional selections, but does not supply multiple initial values or separate export and display labels

With ffSort, the writer sorts the stored option strings using Windows invariant CompareStringW with NORM_IGNORECASE and SORT_STRINGSORT; linguistic ties retain caller order, and clearing the flag preserves the original order

This comparison uses Windows NLS weights rather than a universal alphabet: case-related and other tertiary distinctions can compare equal, secondary weights remain active, and canonical or ignorable sequences may tie; the invariant locale avoids user-locale dependence, while weights can vary across Windows versions

Sorting retains the original option text and InitialValue; exact Unicode equality still identifies the selected spelling, so linguistic ties neither merge options nor select a different value

Standard Helvetica appearances map representable Unicode text through WinAnsiEncoding, including accented letters, the euro sign, ligatures and punctuation; an unrepresentable Unicode scalar paints one question mark while the stored option and value retain their original text

UTF-8 input and ASCII control scalars that PDFDocEncoding cannot preserve are stored as UTF-16 text strings, including embedded NUL; TAB, CR and LF remain escaped inside a single appearance text operand rather than creating list rows

 

See also: AcroForm Support, LastAnnotation