Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Welche Windows Message beim Ändern der Eigenschaften Caption (https://www.delphipraxis.net/134575-welche-windows-message-beim-aendern-der-eigenschaften-caption.html)

himitsu 23. Jul 2009 20:23

Re: Welche Windows Message beim Ändern der Eigenschaften Cap
 
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.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:15 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz