PDFiumPas 文件

FormUndo 方法

组件: TPdfView  ·  单元: PDFium
撤销当前聚焦的 AcroForm 控件上的最近一次编辑,驱动 PDFium 按控件维护的撤销历史

Syntax

function FormUndo: Boolean;

Description

FormUndo is a high-level wrapper around PDFium's FORM_Undo entry point. The PDFium API was already bound at the unit level but had no high-level accessor until v1.23.0; this method exposes per-widget undo to applications.

Each AcroForm widget maintains its own undo / redo stack inside PDFium's form-fill engine. Typing into a text field, deleting characters, paste, autocomplete — every change becomes a new undo entry. FormUndo rolls one step back on the FOCUSED widget; it does NOT undo across multiple widgets at once.

Returns True on success, False when there is nothing to undo (the focused widget's undo stack is empty) or when the view is inactive / has no focused widget. Pair with FormCanUndo to drive an Undo menu item's Enabled state.

Remarks

Example

procedure TForm1.miUndoClick(Sender: TObject);
begin
  if PdfView1.FormCanUndo then
    PdfView1.FormUndo;
end;

procedure TForm1.miEditMenuClick(Sender: TObject);
begin
  miUndo.Enabled := PdfView1.FormCanUndo;
  miRedo.Enabled := PdfView1.FormCanRedo;
end;

See Also

FormRedo, FormCanUndo, FormCanRedo, FormField