Copy/Paste to Clipboard

I have a memo box and a few menu items such as Copy, Cut, Paste, etc.

I would like to know how to copy and paste these items to and from clipboard.

Actually I already got paste to work, but copying the selected text to clipboard, I can't get to work.

aussie_guy_nikAsked:
Who is Participating?
 
MannSoftConnect With a Mentor Commented:
so long as text is selected, Memo1.CopyToClipboard should work.
0
 
kraineyCommented:
Take a look at sending the WM_CUT, WM_PASTE, WM_COPY  messages to the control.
0
 
edeyCommented:
You can also try:

clipBoard.asText := memo1.selText;

or even:

var
 str : pchar;
...
str := memo1.selText;
clipBoard.setTextBuf(str);

For assigning other sorts of data to the clipBoard you can try:

clipBoard.assign(image1.picture.bitmap);

There are many ways to do this, I sugest checking out the help files might be a good idea.

GL
Mike
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
aussie_guy_nikAuthor Commented:
edey

clipboard is not reserved object. isn't there a reserved clipboard object in windows which can be accessed.

tclipboard has to be declared, and I don't know how that's supposed to work.

thanks
0
 
edeyCommented:
TClipboard is globally declared in clipbrd.pas, so you just have to add clipbrd to your uses clause, you don't even have to instantiate it.

GL
Mike
0
 
aussie_guy_nikAuthor Commented:
actually, I figured it out. there seems to be a simpler way to do all this, which unfortunatelly was not provided in any of the answers, so i am deleting this question.
0
 
aussie_guy_nikAuthor Commented:
the simple answer, which seems to work is

memSQL.CopyToClipboard

memSQL.PasteFromClipboard
0
 
MannSoftCommented:
I told you to use CopyToClipboard in the first reply...but if you want to delete the question go ahead
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.