| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
DynaPDF.CreateButton
Creates a push button.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| DynaPDF | 6.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "DynaPDF.CreateButton"; PDF; Name; Caption; Parent; PosX; PosY; Width; Height ) More
Parameters
| Parameter | Description | Example |
|---|---|---|
| The PDF reference returned from DynaPDF.New. | ||
| Name | Name of the button. | "Test" |
| Caption | The caption to use. | "Click me" |
| Parent | Parent group field if any or -1. | -1 |
| PosX | X-Coordinate of the button. | 100 |
| PosY | Y-Coordinate of the button. | 100 |
| Width | Width of the button. | 100 |
| Height | Height of the button. | 20 |
Result
Returns OK or error.
Description
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 DynaPDF.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:
- DynaPDF.GetFieldBackColor and DynaPDF.SetFieldBackColor // Background color * DynaPDF.GetFieldBorderColor and DynaPDF.SetFieldBorderColor // Border color * DynaPDF.GetFieldColor and DynaPDF.SetFieldColor // Change a specific color of a field
- DynaPDF.GetFieldTextColor and DynaPDF.SetFieldTextColor // Color of the caption
- DynaPDF.GetLineWidth and DynaPDF.SetLineWidth // Line width of the border
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 DynaPDF.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
- OnFocus
- OnBlur
Buttons requires a font, if no font was set before Helvetica is used to draw the caption by using the code page 1252. The caption is centred horizontally and vertically. By default the caption is drawn on multiple lines if it does not fit into a single line. To avoid a line break inside a button field remove the flag Multiline (see DynaPDF.SetFieldFlags).
Buttons are excluded from printing by default. If a button should be printable set the flag Print (see DynaPDF.SetFieldFlags() for further information).
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 field handle, a value greater or equal zero. If the function fails the return value is an error.
See also CreateButton function in DynaPDF manual.
Examples
Create a button with a link action:
# add a button to open MBS website
Set Variable [ $r ; Value: MBS("DynaPDF.SetBorderStyle"; $pdf; "Bevelled") ]
Set Variable [ $Button ; Value: MBS( "DynaPDF.CreateButton"; $pdf; "MBSButton"; "Visit MBS Website"; -1; 350; 350; 200; 20 ) ]
Set Variable [ $Action ; Value: MBS( "DynaPDF.CreateURIAction"; $pdf; "https://www.monkeybreadsoftware.com/filemaker/" ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.AddActionToObj"; $pdf; "Field"; "OnMouseUp"; $Action; $Button ) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetBorderStyle"; $pdf; "Bevelled") ]
Set Variable [ $Button ; Value: MBS( "DynaPDF.CreateButton"; $pdf; "MBSButton"; "Visit MBS Website"; -1; 350; 350; 200; 20 ) ]
Set Variable [ $Action ; Value: MBS( "DynaPDF.CreateURIAction"; $pdf; "https://www.monkeybreadsoftware.com/filemaker/" ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.AddActionToObj"; $pdf; "Field"; "OnMouseUp"; $Action; $Button ) ]
See also
- DynaPDF.CreateJSAction
- DynaPDF.CreateListBox
- DynaPDF.GetFieldBorderColor
- DynaPDF.GetFieldColor
- DynaPDF.SetBorderStyle
- DynaPDF.SetFieldBackColor
- DynaPDF.SetFieldColor
- DynaPDF.SetFieldFlags
- DynaPDF.SetFieldTextColor
- DynaPDF.SetLineWidth
Example Databases
- DynaPDF/Create PDF with sum form field
- DynaPDF/Create Text as PDFA
- DynaPDF/Form/Form
- DynaPDF/PDF Attachments
Blog Entries
- PDF Attachments in FileMaker with DynaPDF
- New in version 11.5 of MBS FileMaker Plugin
- MBS FileMaker Plugin, version 6.4pr5
This function checks for a license.
Created 26th August 2016, last changed 6th March 2026
MarkDown version: DynaPDFCreateButton.md