TechStone
asked on
Put a String on the Clipboard
In my program I have a string that I want to put on the clipboard, so I can paste it in another application (for example a word processor). How do I do that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
P.S. Add ClipBrd to your uses clause in order to use TClipBoard.
ASKER
Thank you, that works perfectly!
procedure CopyButtonClick(Sender: TObject);
begin
If ActiveControl is TMemo then TMemo(ActiveControl).CopyT oClipboard ;
If ActiveControl is TDBMemo then TDBMemo(ActiveControl).Cop yToClipboa rd;
If ActiveControl is TEdit then TEdit(ActiveControl).CopyT oClipboard ;
If ActiveControl is TDBedit then TDBedit(ActiveControl).Cop yToClipboa rd;
end;
procedure PasteButtonClick(Sender: TObject);
begin
If ActiveControl is TMemo then TMemo(ActiveControl).Paste FromClipbo ard;
If ActiveControl is TDBMemo then TDBMemo(ActiveControl).Pas teFromClip board;
If ActiveControl is TEdit then TEdit(ActiveControl).Paste FromClipbo ard;
If ActiveControl is TDBedit then TDBedit(ActiveControl).Pas teFromClip board;
end;
begin
If ActiveControl is TMemo then TMemo(ActiveControl).CopyT
If ActiveControl is TDBMemo then TDBMemo(ActiveControl).Cop
If ActiveControl is TEdit then TEdit(ActiveControl).CopyT
If ActiveControl is TDBedit then TDBedit(ActiveControl).Cop
end;
procedure PasteButtonClick(Sender: TObject);
begin
If ActiveControl is TMemo then TMemo(ActiveControl).Paste
If ActiveControl is TDBMemo then TDBMemo(ActiveControl).Pas
If ActiveControl is TEdit then TEdit(ActiveControl).Paste
If ActiveControl is TDBedit then TDBedit(ActiveControl).Pas
end;