PDFiumVCL 文件

OnSelectionChange event

此 API 條目保留識別符號、簽名、程式碼塊和 PDF 術語的原始形式。
Component: TPdfView  ·  Unit: PDFium
Fires when the materialised text selection ranges actually change.

Syntax

property OnSelectionChange: TNotifyEvent;

Description

Notifies the host that the text selection has mutated. Fires on every transition where the materialised FSelection ranges differ from the previous state — including empty → non-empty (a drag starts to grab characters), non-empty → empty (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 twice on the same page). The internal range-equality check short-circuits identical re-application, so the event can be wired directly to status-bar text or button enabled state without debouncing.

Remarks

Example

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

See Also

AllowUserTextSelection, HasSelection, SelectionCharCount, SelectedText