Double-clicking a TStaticText on a form copies the caption of that TStaticText to the clipboard. No double-click event is needed.
Steps to reproduce:
- Using Win 64 and Delphi XE2 update 4.
- Create a VCL Forms app.
- Place a TEdit on the form.
- Place a TStaticText on the form. Change caption to "TStaticText1Caption"
- Place a second TStaticText on the form. Change caption to "TStaticText2Caption"
- Run program(F9)
- Type some text into the TEdit. Select it all and copy it via CTRL+C.
- Delete the text in the TEdit. Paste it in to verify the text is what you copied.
- Delete the text in the TEdit.
- Double-click either TStaticText.
- Paste text into TEdit. Notice it is not the original copied text but the caption of the TStaticText.
I have already submitted a bug report to Embarcadero.
I tried assigning a double-click event to the TStaticTexts. It still copies the caption to the clipboard even though it executes the double-click event.
procedure TForm1.StaticText1DblClick(Sender: TObject);
begin
Edit1.Text := 'Hello';
end;
procedure TForm1.StaticText2DblClick(Sender: TObject);
begin
Edit1.Text := 'World';
end;
This does not happen with TLabel or any other VCL control I have tried.
We have lots of TStaticTexts on our forms for visual design purposes and changing to TLabels is not an option.
Anybody have any ideas on how to prevent this from happening?