Link to home
Start Free TrialLog in
Avatar of aussie_guy_nik
aussie_guy_nik

asked on

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.

ASKER CERTIFIED SOLUTION
Avatar of MannSoft
MannSoft

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Take a look at sending the WM_CUT, WM_PASTE, WM_COPY  messages to the control.
Avatar of edey
edey

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
Avatar of aussie_guy_nik

ASKER

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
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
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.
the simple answer, which seems to work is

memSQL.CopyToClipboard

memSQL.PasteFromClipboard
I told you to use CopyToClipboard in the first reply...but if you want to delete the question go ahead