DelphiFAQ Home Search:

Copy from the active control to the clipboard

 

comments1 comments. Current rating: 4 stars (1 votes). Leave comments and/ or rate it.

Use the following piece of code for this.

Note: You may trigger the menu open event and enable/ disable the
copy/ paste menu items depending on the type of control that is active.

procedure CopyButtonClick(Sender: TObject);
begin
  if ActiveControl is TMemo then TMemo(ActiveControl).CopyToClipboard;
  if ActiveControl is TDBMemo then TDBMemo(ActiveControl).CopyToClipboard;
  if ActiveControl is TEdit then TEdit(ActiveControl).CopyToClipboard;
  if ActiveControl is TDBedit then TDBedit(ActiveControl).CopyToClipboard;
end;
 
procedure PasteButtonClick(Sender: TObject);
begin
  if ActiveControl is TMemo then TMemo(ActiveControl).PasteFromClipboard;
  if ActiveControl is TDBMemo then TDBMemo(ActiveControl).PasteFromClipboard;
  if ActiveControl is TEdit then TEdit(ActiveControl).PasteFromClipboard;
  if ActiveControl is TDBedit then TDBedit(ActiveControl).PasteFromClipboard;
end;

Comments:

2006-06-11, 02:05:45
afshinmar@yahoo.com from Iran  
rating
Hi
Thank you very much for this programs
i want disable/enable copy& paste drug&drup in windows whit delphi for a secure programing
help me please
my email is:
afshinmar@yahoo.com

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: