Solved

Cut and paste

Posted on 2004-08-30
8
167 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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