FocusField

Forms, interaction, input

Description

Moves Widget focus of a TPDFlibFormSession to a requested visible field or temporary Widget index

An active edit on the previously focused Widget is committed or cancelled first, and its /Bl blur action is dispatched; a veto keeps the previous focus and returns 0

The /Fo focus action is then dispatched for the requested Widget; when it is vetoed, focus clears completely and the transition to zero is still reported through OnFocusChanged

Requesting the Widget that already has focus returns 1 without dispatching any action

Declaration

function FocusField(FieldIndex: Integer;
  CommitCurrent: Boolean = True): Integer;

Parameters

FieldIndexField or temporary Widget index to focus
CommitCurrentTrue commits the active edit before the transition, False cancels it

Return value

Returns 1 when the requested Widget now has focus, otherwise 0 when the request was reentrant, the field is invalid or a blur or focus action was vetoed

See also

Blur, FocusNext, FocusAt, BeginEdit, DispatchAction, FocusedFieldIndex, TPDFlibFormSession