GetSelectionRange
表單、互動、Unicode
描述
查詢作用中的表單欄位編輯選取範圍,不改變其方向或內容
傳回的記錄包含方向性的錨點與游標,以及以所請求索引單位表示的有序起點與長度
宣告
function GetSelectionRange(IndexUnit: TPDFlibFormSelectionUnit;
out Selection: TPDFlibFormSelection): Integer;
參數
| IndexUnit | fsuUTF16CodeUnit、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;