Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to copy from the active control to the clipboard Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Copy from the active control to the clipboard 11-Sep-02
Category
Win API
Language
Delphi 2.x
Views
96
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert 

Copy from the active control to the clipboard

Answer:

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.


1   procedure CopyButtonClick(Sender: TObject);
2   begin
3     if ActiveControl is TMemo then
4       TMemo(ActiveControl).CopyToClipboard;
5     if ActiveControl is TDBMemo then
6       TDBMemo(ActiveControl).CopyToClipboard;
7     if ActiveControl is TEdit then
8       TEdit(ActiveControl).CopyToClipboard;
9     if ActiveControl is TDBedit then
10      TDBedit(ActiveControl).CopyToClipboard;
11  end;
12  
13  procedure PasteButtonClick(Sender: TObject);
14  begin
15    if ActiveControl is TMemo then
16      TMemo(ActiveControl).PasteFromClipboard;
17    if ActiveControl is TDBMemo then
18      TDBMemo(ActiveControl).PasteFromClipboard;
19    if ActiveControl is TEdit then
20      TEdit(ActiveControl).PasteFromClipboard;
21    if ActiveControl is TDBedit then
22      TDBedit(ActiveControl).PasteFromClipboard;
23  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC