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


Creates a combo box.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.CreateComboBox"; 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 If 1, the items are sorted. 0
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.


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

A combo box can contain value that is not included in the array of choice values. This value can be used to display a string in the combo box when no choice value is selected, e.g. "Select a value!".

The field value can be set with the function DynaPDF.SetFieldExpValue as follows:

The parameter ValIndex of the function DynaPDF.SetFieldExpValue must be set to PDF_MAX_INT (2147483647) and the parameter Value must contain the whished value or be empty. If Value is empty string, a maybe existing field value will be deleted. The choice values of the combo box get the state unselected when setting a field value in this way.

If the coordinate system is bottom-up the point PosX, PosY defines the lower left corner of the button. 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 DynaPDF.SetBorderStyle or DynaPDF.SetFieldBorderStyle.

The values of the combo box are sorted if the parameter Sort is 1.
A combo box requires a font. If no font is active the standard font Helvetica is used. Note: 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 combo 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.

Specific flags supported by combo boxes:

EditEnable adding of values in Adobe's Acrobat
SortedChange the sort flag if necessary
CommitOnSelChSubmit the new value immediately (PDF 1.5)
DoNotSpellCheckDisable spell checking (requires Edit)

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 it returns an error message.

See also CreateComboBox function in DynaPDF manual.

See also

Blog Entries

This function checks for a license.

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

DynaPDF.CreateCheckBox - DynaPDF.CreateDPartRoot