PDFium Component Docs

OnSelectionChange event

この API エントリでは識別子、シグネチャ、コードブロック、PDF 用語を元の表記のまま保持します。
コンポーネント: TPdfView  ·  ユニット: PDFium
Fires when the materialised text selection ranges actually change.

構文

property OnSelectionChange: TNotifyEvent;

説明

テキスト選択が変化したことをホストへ通知します。実体化されたFSelection範囲が前の状態と異なるすべての遷移で発生します — 空 → 非空 (ドラッグが文字を取得し始める)、非空 → 空 (ClearSelection, page change, deactivate, document switch), and any range mutation in between (Shift+Right, mouse-move drag extension, double-click word expansion).

Does NOT fire when the same selection is set again (e.g. calling SelectAll同じページで 2 回呼び出す場合) などです。内部の範囲等価性チェックは同一の再適用を短絡するため、このイベントはデバウンスなしでステータスバー文字列やボタンの有効状態へ直接接続できます

備考

procedure TForm1.PdfViewSelectionChange(Sender: TObject);
begin
  StatusBar1.Panels[0].Text :=
    Format('%d chars selected', [PdfView1.SelectionCharCount]);
  CopyButton.Enabled := PdfView1.HasSelection;
end;

関連項目

AllowUserTextSelection, HasSelection, SelectionCharCount, SelectedText