Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 213

Previous Page 212   Index   Next Page 214

Function Reference
Page 213 of 750
CreateButton
Syntax:
SI32 pdfCreateButton(
const PPDF* IPDF,
// Instance pointer
const char* Name,
// Name of the button
const char* Caption, // Caption
SI32 Parent,
// Parent group field or -1
double PosX,
// X-Coordinate of the button
double PosY,
// Y-Coordinate of the button
double Width,
// Width in unscaled units
double Height)
// Height in unscaled units
This function creates a push button. The parameter Name must be a unique name for the button field.
It is not allowed to create two buttons with an identical name within the hierarchy in which they
appear.
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 and height of a form field.
The border is drawn by using the current line width and border style (see SetBorderStyle()).
However, interactive form fields support natively the line width 1, 2 and 3 units only (thin, medium,
thick). Other values can be applied but the appearance can be changed by Adobe's Acrobat when the
form is reset by a Reset Form Action.
The appearance can be influenced with the following properties:
Get/SetFieldBackColor()
// Background color
Get/SetFieldBorderColor() // Border color
Get/SetFieldColor()
// Change a specific color of a field
Get/SetFieldTextColor()
// Color of the caption
Get/SetLineWidth()
// Line width of the border
The border and background color can be set to NO_COLOR, the background or border appears then
transparent. The border appears also transparent when the line width was set to zero.
DynaPDF supports also image buttons. To create an image button store the handle of the button in a
variable and add one or more images to the different button states (see AddButtonImage() for
further information). The caption of the button will be overridden when an image to the up state is
added.
Buttons are used to execute an action; the following events are supported by button fields:
OnMouseUp
OnMouseDown
OnMouseExit
 

Previous topic: CreateBarcodeField

Next topic: CreateCheckBox