SetFormFieldAction

Form fields, Annotations and hotspot links

Description

Binds an existing action dictionary to a form-field trigger

Syntax

Delphi

Function TPDFlib.SetFormFieldAction(Index: Integer; Const ActionType: WideString; ActionID: Integer): Integer;

DLL

int DLSetFormFieldAction(int InstanceID, int Index, const wchar_t * ActionType, int ActionID);

Parameters

IndexThe 1-based form-field index
ActionTypeThe trigger name: E, X, D, U, Fo, Bl, K, F, V, or C
ActionIDAn action handle returned by GetAnnotActionID, GetOutlineActionID, or GetFormFieldActionID

Return values

0The field, trigger, or action handle was invalid
1The action was copied and assigned to the field trigger

Remarks

The action dictionary is copied into the selected document before it is assigned to the field, so later edits to the original action do not mutate the field trigger

Use ActionType U for the primary mouse-up activation action, matching the action read by GetFormFieldActionID(Index, 'U')

Use RemoveFormFieldAction to clear a trigger and GetFormFieldActionInfo to inspect the assigned action through TPDFlibActionInfo