Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#6

Re: Mal wieder: Copy and Paste

  Alt 25. Apr 2004, 17:10
Zitat von alcaeus:
Delphi-Quellcode:
if (Form1.ActiveControl is TEdit) or
  (Form1.ActiveControl is TRichEdit) or
  (Form1.AcitveControl is <anderes Control>) then
  (ActiveControl as TEdit).CopyToClipBoard;
Dies müsste eigentlich funktionieren, ist aber nicht getestet.
Nein das funktioniert nicht, denn man muss vor dem CopyToClipBoard noch SelectAll
ausführen.

Zudem ist TRichEdit, TEdit, TMemo usw. von TCustomEdit abgeleitet, d.h
es geht einfacher so:

Delphi-Quellcode:
  if (ActiveControl is TCustomEdit) then
  begin
    TCustomEdit(ActiveControl).Selectall;
    TCustomEdit(ActiveControl).CopyToClipboard;
  end;
Thomas
  Mit Zitat antworten Zitat