2010. augusztus 1., vasárnap

Add cut copy and paste easy

Problem/Question/Abstract:

Text here...

Answer:

Articles::The Easy way to Cut Copy and Paste




After a lot of hair pulling out I stumbled across this method of using the windows messages. This is best demonstrated with the following code:

procedure TForm1.Cut1Click(Sender: TObject);
begin
SendMessage (ActiveControl.Handle, WM_Cut, 0, 0);
end;


procedure TForm1.Copy1Click(Sender: TObject);
begin
SendMessage (ActiveControl.Handle, WM_Copy, 0, 0);
end;

procedure TForm1.Paste1Click(Sender: TObject);
begin
SendMessage (ActiveControl.Handle, WM_Paste, 0, 0);
end;

If you are developing a MDI application, you will need to make sure that the message is sent to the active child by using: ActiveMDIChild.ActiveControl.Handle

..

Nincsenek megjegyzések:

Megjegyzés küldése