Solved

Cut and paste

Posted on 2004-08-30
8
163 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

19 Experts available now in Live!

Get 1:1 Help Now