Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


This function creates a list box.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.CreateListBox"; PDF; Name; Sort; Parent; PosX; PosY; Width; Height )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Name Name of the field "IsMale"
Sort Sort the choice values? 0 = no, 1 = yes. 1
Parent Parent group field if any or -1. -1
PosX X-Coordinate of the text field. 100
PosY Y-Coordinate of the text field. 100
Width Width of the text field. 100
Height Height of the text field. 20


Returns handle or error.


This function creates a list box.
The choice values of the list box must be added with the function DynaPDF.AddValToChoiceField. This function requires the field handle that was returned by this function.

If the coordinate system is bottom-up the point PosX, PosY defines the lower left corner of the list box. If the coordinate system is top-down it defines the upper left corner.

Like all form fields, the width and height is measured incl. the line width of the border. The size of normal vector graphics is measured without the line width; this must be taken into account when calculating the width or height of a form field. The line width of the border is derived from the current graphics state (see DynaPDF.SetLineWidth), it should be either 0, 1, 2, or 3 units (no border, thin, medium, or thick). The border style can be changed with the functions SetBorderStyle() or DynaPDF.SetFieldBorderStyle.

The values of the list box are sorted if the parameter Sort is true. List boxes support multiple selected values. To enable multi selection add the flag ffMultiSelect to the field (see DynaPDF.SetFieldFlags for further information).
A list box requires a font. If no font is active the standard font Helvetica is used. Note that if the form must be compatible to Acrobat 4, the used fonts by the form fields must be restricted to the 14 standard fonts (see SetFont() for further information). Acrobat 4 does not support interactive forms that use other fonts than the 14 standard fonts. Such a form requires Acrobat 5 or higher.

However, it is possible to use an arbitrary font as long as the code page 1252 is used.

The font size of a list box is set to "auto" if either the font size of the active font is set to 1.0 unit or if no font is active when the field is created.

A text field can be formatted and the allowed input values can be restricted to specific data formats. See DynaPDF.SetDateTimeFormat, DynaPDF.SetNumberFormat for further information.

Specific flags supported by list boxes:
• Sorted // Change the sort flag if necessary
• MultiSelect // Enable multi selection

Earlier versions of DynaPDF allowed the usage of arbitrary 8 bit code pages. Due to changes in Acrobat viewer applications it is no longer possible to use another code page than 1252. In addition, it seems that Acrobat versions greater 6 do no longer support Type1 fonts in form fields, with the exception of the 14 standard fonts.

Interactive form fields can be structured into several groups by passing a handle of a group field to the parameter Parent. See DynaPDF.CreateGroupField for further information.

If the function succeeds the return value is the handle of the combo box, a value greater or equal zero. If the function fails the return value is a negative error code.

See also CreateListBox function in DynaPDF manual.

See also

This function checks for a license.

Created 18th August 2014, last changed 18th August 2014

DynaPDF.CreateJSAction - DynaPDF.CreateNamedDest