ImageEn, unit imageenview

TIETextEditorEvent


Declaration

TIETextEditorEvent = procedure(Sender: TObject; Index: integer; Editor: TObject) of object;


Description

Index is the index of the layer, PDF object or annotation being edited.
Index will be >= 2,000,000,000 when editing a text annotation of a PDF
Index will be >= 1,000,000,000 when editing a text object of a PDF
Otherwise it will be a layer

Editor is the editing control.
For TIELineLayer it is a TIEEdit
For TIETextLayer it is a TIERichEdit when EnableFormatting=True. Otherwise it is a TIEEdit
For PDF objects it is a TIEEdit


Example

procedure TForm1.ImageEnView1ActivateTextEditor(Sender: TObject; Index: Integer; Editor: TObject);
const
  PDFIUM_OBJECT_INDEX     = 1000000000;
  PDFIUM_ANNOTATION_INDEX = 2000000000;
begin
  // Ensure it is not a PDF object/Annotation
  if Index >= PDFIUM_OBJECT_INDEX then
    exit;

  // Show Text Editor with Yellow background for Line Layers (always a TIEEdit)
  if ImageEnView1.Layers[ Index ].Kind = ielkLine then
    TIEEdit( Editor ).Color := clYellow
  else
  // Show Text Editor with Gray background for Text Layers (may be TIERichEdit or TIEEdit)
  if Editor is TIEEdit then
    TIEEdit( Editor ).Color := clGray
  else
  if Editor is TIERichEdit then
    TIERichEdit( Editor ).Color := clGray;
end;