ImageEn, unit imageenview

TImageEnView.LayersTextEditor

TImageEnView.LayersTextEditor


Declaration

function LayersTextEditor(): TCustomEdit;


Description

Returns the active Text editor, or nil if editing is not active.
For a TIELineLayer the editor type will be a TIEEdit. For TIETextLayer it is a TIERichEdit when EnableFormatting=True. Otherwise it is a TIEEdit.


Example

// Prevent user from entering too much text
procedure Tfmain.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);
const
  Maximum_Text_Length = 10;
var
  editor: TIEEdit;
  pos: Integer;
  s: string;
begin
  if ( Maximum_Text_Length > 0 ) and  ( event =  ielTextEditorChange ) then
  begin
    if ImageEnView1.LayersTextEditor is TIEEdit then
    begin
      editor := TIEEdit( ImageEnView1.LayersTextEditor );
      if Length( editor.Text ) > Maximum_Text_Length then
      begin
        pos := editor.SelStart;
        s := editor.Text;
        SetLength( s, Maximum_Text_Length );
        editor.Text := s;
        editor.SelStart := pos;
      end;
    end;
  end;
end;


See Also

ActivateEditor
ActivateEditor
LayersEditingLayer
CancelTools