GetSelectionRange

表单、交互、Unicode

描述

查询活动的表单字段编辑选择,不改变其方向或内容

返回的记录包含方向性锚点与插入符,以及按请求索引单位给出的有序起点和长度

声明

function GetSelectionRange(IndexUnit: TPDFlibFormSelectionUnit;
  out Selection: TPDFlibFormSelection): Integer;

参数

IndexUnitfsuUTF16CodeUnit、fsuUnicodeCodePoint 或 fsuGraphemeCluster
Selection接收转换后的有向规范化范围

选定字段

IndexUnit所有返回索引和长度使用的单位
AnchorIndex选定范围的固定端
CaretIndex选定范围的移动端
StartIndex转换后锚点与插入符位置中较小者
SelectionLength有序转换后边界之间的距离
IsReversed内部 UTF-16 锚点位于插入符之后时为 True

返回值

编辑处于活动状态并返回选定范围时返回 1;否则清空 Selection 并返回 0

示例

var
  Selection: TPDFlibFormSelection;
begin
  if Session.GetSelectionRange(fsuGraphemeCluster, Selection) = 1 then
    GraphemeCount := Selection.SelectionLength;
end;

另请参阅

SetSelectionRange, TPDFlibFormSession