PDFium Delphi Component Docs

SetFocusableAnnotationSubtypes 方法

组件: TPdf  ·  单元: PDFium
替换表单填充环境在键盘交互期间视为可获得焦点的注释子类型列表

语法

procedure SetFocusableAnnotationSubtypes(const Subtypes: array of TPdfAnnotationSubtype);

SubtypesTPdfAnnotationSubtype 开放数组。完整的替换列表;数组中不存在的任何子类型的注释都无法获得焦点。空数组会清空该列表

说明

表单填充环境维护一个可获得焦点的注释子类型列表。默认情况下该列表涵盖表单控件,FocusFormField 等键盘导航正是在这些控件之间移动。此调用通过原生接口(FPDFAnnot_SetFocusableSubtypes)替换整个列表,例如让查看器也能将焦点赋予自由文本或其他标记类注释

每个 TPdfAnnotationSubtype 值在调用前都会编码为对应的原生值。传入空数组会以计数零转发 nil 指针并清空列表,在设置新列表之前没有任何对象可以获得焦点

该调用要求已加载文档且表单填充环境已初始化;表单未初始化时会引发消息为 Form fill environment is not initialized 的 EPdfError。原生调用失败会引发 Cannot set focusable annotation subtypes。可使用 GetFocusableAnnotationSubtypes 读回当前列表

备注

示例

begin
  Pdf1.FileName := 'form.pdf';
  Pdf1.Active := True;
  // widgets stay focusable, free-text notes join them
  Pdf1.SetFocusableAnnotationSubtypes([anWidget, anFreeText]);
end;

参见

GetFocusableAnnotationSubtypes, FocusFormField, SetFormFieldFlags, FormField