Hallo,
der Trick ist immer der gleiche - eine nachträgliche Erweiterung des betreffenden Controls:
Delphi-Quellcode:
type
TLabel = class (StdCtrls.TLabel)
private
FOnChange : TNotifyEvent;
procedure CMTextChanged (var Message: TMessage); message CM_TEXTCHANGED;
public
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TForm1 = class (TForm)
{...}
procedure FormCreate (Sender: TObject);
private
procedure LabelChanged (Sender: TObject);
end;
procedure TLabel.CMTextChanged (var Message: TMessage);
begin
inherited;
if Assigned(FOnChange) then
FOnChange (Self);
end;
procedure TForm1.FormCreate (Sender: TObject);
begin
Label1.OnChange := LabelChanged;
end;
procedure TForm1.LabelChanged (Sender: TObject);
begin
Self.Caption := (Sender as TLabel).Caption;
end;
Gruß Hawkeye