Solved

Cut and paste

Posted on 2004-08-30
8
164 Views
Last Modified: 2010-04-05
Hello,

I want to create a simple application like this :

It has a button.

If I click that button, then it will send a text to the clipboard system.

So, if I press CTRL-V, that text will be pasted to notepad for example.

Anyone know how to send text (multiple lines) to clipboard system ?

thanks
0
Comment
Question by:kapot
  • 4
  • 2
  • 2
8 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 60 total points
ID: 11930701
uses tclipboard;

...
begin
  Clipboard.SetTextBuf(PCHar('MyLongText'+#10+'SecondLine');
end;

just from head

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11930712
one ) missed on end
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11930861
procedure TForm1.Button1Click(Sender: TObject);
begin
  if (Memo1.SelLength>0) then
    Memo1.CopyToClipboard;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Memo2.PasteFromClipboard;
end;
0
 
LVL 4

Assisted Solution

by:Colin_Dawson
Colin_Dawson earned 40 total points
ID: 11930886
you'd be better using #13#10 for the line  break.   #13 is a carriage return and #10 is a line feed.   Some programs will accept an either/or/or both combination, but there are some others that MUST have the pair.  Notepad itself isn't too fussy, but it's best to be complete.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 11930928
well, agreed, colin :-))
0
 
LVL 4

Expert Comment

by:Colin_Dawson
ID: 11931662
Just call me "Mr. Pedantic" ;-)

Your suggestion answers the question so I think you should get the points.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11932704
I forgot to mention that it is a must to be into the uses-clause:

uses
  ...., Clipbrd
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11932801
hum, of course Clipbrd not tclipboard as i mentioned above (copy/paste error)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
proper way to parse url in delphi 2 162
Delphi cmd execution 6 55
Delphi Mdi application Child forms get behind control 7 154
Graphics32 under Delphi 10.1 Berlin 2 36
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now