API referenceForms

pdfCreateListBox

Create a Choice-type field (/FT /Ch) — combo box

C
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);
Delphi
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.

ParameterDescription
IPDFDocument handle.
NameField name.
SortWhether the option list is alphabetically sorted.
ParentAccepted but silently dropped.
PosX, PosY, Width, HeightPlacement 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)

wrappers/dotnet/LumasPdf.cs
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);
Area
Forms
Category

Object Creation

Exported names

pdfCreateListBox

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.