versuch es mal mit CM_TEXTCHANGED
Delphi-Quellcode:
property Caption: TCaption read GetText write SetText stored IsCaptionStored;
procedure TControl.SetText(const Value: TCaption);
begin
if GetText <> Value then
SetTextBuf(PChar(Value));
end;
procedure TControl.SetTextBuf(Buffer: PChar);
begin
Perform(WM_SETTEXT, 0, Buffer);
Perform(CM_TEXTCHANGED, 0, 0);
end;
ansonsten ein "Hack"
dieses in eine
Unit
Delphi-Quellcode:
Unit LabelHack;
Interface
Uses Classes, Controls, StdCtrls;
Type TLabel =
Class(StdCtrls.TLabel)
Private
FChange: TNotifyEvent;
Function GetText: TCaption;
Procedure SetText(
Const Value: TCaption);
Published
Property OnChange: TNotifyEvent
Read FChange
Write FChange;
Property Caption: TCaption
Read GetText
Write SetText;
End;
Implementation
Function TLabel.GetText: TCaption;
Begin
Result :=
inherited Caption;
End;
Procedure TLabel.SetText(
Const Value: TCaption);
Begin
If inherited Caption <> Value
then Begin
inherited Caption := Value;
If Assigned(FChange)
Then FChange(Self);
End;
End;
End.
und dann diese
Unit überall, als Allerletztes in der Uses-Klausel einbinden, wo TLabel verwendet wird.