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