cerebrumconsulting
asked on
Delphi TEdit.PasteFromClipboard won't work
I'm running Delphi XE7 on Windows 7. I've created a simply project with a button and two edits. This is the button click event:
procedure TForm2.Button1Click(Sender : TObject);
begin
Edit1.Text := 'Paste this text';
Edit1.SelStart := 6;
Edit1.SelLength := 4; // Remove "this"
Edit1.CutToClipboard;
Edit2.PasteFromClipboard;
end;
This fails. The copy and cut functions (I've tested both) work. However, the Paste function fails. The KeyPreview property on the form is false.
I have no clue why this simple code is failing.
Eric
PasteTest.zip
procedure TForm2.Button1Click(Sender
begin
Edit1.Text := 'Paste this text';
Edit1.SelStart := 6;
Edit1.SelLength := 4; // Remove "this"
Edit1.CutToClipboard;
Edit2.PasteFromClipboard;
end;
This fails. The copy and cut functions (I've tested both) work. However, the Paste function fails. The KeyPreview property on the form is false.
I have no clue why this simple code is failing.
Eric
PasteTest.zip
ASKER
No, I just tried that. It makes no difference even working with two TEdits.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Edit2 is a TRzEdit while Edit1 is a TEdit.
Looks like TRzEdit doesn't handle de PasteFromClipBoard method.
Your sample project will work fine if you replace your TRzEdit with a TEdit.
GB