int32_t __stdcall pdfCreateComboBox(PPDF IPDF, const char* Name, int32_t Sort, int32_t Parent, double PosX, double PosY, double Width, double Height);
int32_t __stdcall pdfCreateListBox(PPDF IPDF, const char* Name, BOOL32 Sort, int32_t Parent, double PosX, double PosY, double Width, double Height);
function pdfCreateComboBox(const IPDF: PPDF; const Name: PAnsiChar; Sort, Parent: Integer; PosX, PosY, Width, Height: Double): Integer; stdcall;
function pdfCreateListBox(const IPDF: PPDF; const Name: PAnsiChar; Sort: LongBool; Parent: Integer; PosX, PosY, Width, Height: Double): Integer; stdcall;
Purpose. Create a Choice-type field (/FT /Ch) — combo box (dropdown, /Ff Combo bit set) or list box.
Description. Both are the literal same underlying function (AddChoiceField(Name, IsCombo, Sort, ...)) with an IsCombo discriminator baked into each entry point (True for combo, False for list) — the same "shared implementation with a boolean flag" pattern seen repeatedly elsewhere in this manual (e.g. pdfCircleAnnot/pdfSquareAnnot, Markup and Shape Annotation Creators).
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Name | Field name. |
Sort | Whether the option list is alphabetically sorted. |
Parent | Accepted but silently dropped. |
PosX, PosY, Width, Height | Placement box. |
Return value. The new field's handle; 0 if IPDF is invalid.
Remarks. Populate the option list afterward via whichever choice- value setter exists elsewhere in this ABI (pdfSetFieldExpValue/ pdfSetFieldExpValueEx, Field Values) — creation alone produces an empty choice list.
C# (P/Invoke)
public static extern int pdfCreateListBox(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name, [MarshalAs(UnmanagedType.Bool)] bool Sort, int Parent, double PosX, double PosY, double Width, double Height);
Object Creation
pdfCreateListBox
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.