Double-click TStaticText in Delphi XE2 application copy header to clipboard

Double-clicking on the TStaticText in the form copies the title of this TStaticText to the clipboard. No double-click event required.

Steps to play:

  • Using Win 64 and Delphi XE2 update 4.
  • Create a VCL Forms application.
  • Put TEdit on the form.
  • Put the TStaticText on the form. Change the title to "TStaticText1Caption"
  • Place the second TStaticText on the form. Change the title to "TStaticText2Caption"
  • Run the program (F9)
  • Enter text in TEdit. Select all and copy it using CTRL + C.
  • Delete text in TEdit. Paste it to verify that the text is what you copied.
  • Delete text in TEdit.
  • Double-click the TStaticText icon.
  • TEdit. , , TStaticText.

Embarcadero.

TStaticTexts. - , .

procedure TForm1.StaticText1DblClick(Sender: TObject);
begin
  Edit1.Text := 'Hello';
end;

procedure TForm1.StaticText2DblClick(Sender: TObject);
begin
  Edit1.Text := 'World';
end;

TLabel VCL-, .

TStaticTexts , TLabels .

- , ?

+5
1

delphi, Windows Static Control, VCL TStaticText.

Windows Vista Static text , , SS_NOTIFY ( SS_NOTIFY CreateParams TCustomStaticText)

, ?

SS_NOTIFY, CreateParams

type
  TStaticText = class(Vcl.StdCtrls.TStaticText)
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  end;

  TForm1 = class(TForm)
    StaticText1: TStaticText;
  private
  public
  end;

var
  Form1: TForm42;

implementation

{$R *.dfm}

{ TStaticText }

procedure TStaticText.CreateParams(var Params: TCreateParams);
begin
  inherited;
  with Params do
    Style := Style and not SS_NOTIFY;
end;

: , , STN_CLICKED, STN_DBLCLK, STN_DISABLE STN_ENABLE, .

+8

All Articles