OnAction
Forms, interaction
Description
Occurs whenever the TPDFlibFormSession is about to honor an available Widget action
The callback receives the Widget index, the single-character PDF trigger event and a typed TPDFlibActionInfo describing the configured action, which is looked up on the Widget first and on its base field when the Widget itself carries no action
Triggers observed through this callback include /Fo and /Bl on focus transitions, /K on selection edits and choice changes, /V and /F during commits and /E, /X, /D and /U during pointer interaction
The callback fires only when an action is actually configured, and setting Allow to False vetoes the pending operation, for example denying a focus change or retaining an active edit after a rejected commit
Declaration
property OnAction: TPDFlibFormSessionActionEvent;
Handler parameters
| Sender | Session that dispatched the action |
|---|---|
| FieldIndex | Field or temporary Widget index the action belongs to |
| TriggerEvent | PDF trigger event name, such as 'Fo', 'Bl', 'K', 'V', 'F', 'E', 'X', 'D' or 'U' |
| ActionInfo | Typed description of the configured action |
| Allow | Veto flag, preset to True and set to False to reject the pending operation |
Example
procedure TForm1.SessionAction(Sender: TObject; FieldIndex: Integer;
const TriggerEvent: AnsiString; const ActionInfo: TPDFlibActionInfo;
var Allow: Boolean);
begin
if TriggerEvent = 'V' then
Allow := ValidateBeforeCommit(FieldIndex);
end;
See also
DispatchAction, TPDFlibActionInfo, OnFocusChanged, OnTextEdit, OnValueChanged, ExecuteFormFieldScript