Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-02

How to detect an any property change in object?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

Hi,

I have some class with propertys:

type TMyClass = class
  private
    FProperty1: Boolean;
    FProperty2: String;
    procedure SetProperty2(AValue: String);
    procedure ClassChanged;
  public
    property Property1: Boolean read FProperty1 write FProperty;
    property Property2: String read FProperty2 write SetProperty2;
  end;

I want call ClassChanged on each property change. I could create SetXXX function for all propertys and there call this method, but exists any "low level" hack to detect "write" operation on custom property?

Regards.

Reply by email

Unknown author
to Krzysztof
Krzysztof wrote 19 lines
Hi, I have some class with propertys: type TMyClass = class private FProperty1: Boolean; FProperty2: String; procedure SetProperty2(AValue: String); procedure ClassChanged; public property Property1: Boolean read FProperty1 write FProperty; property Property2: String read FProperty2 write SetProperty2; end; I want call ClassChanged on each property change. I could create SetXXX function for all propertys and there call this method, but exists any "low level" hack to detect "write" operation on custom property?

Not as part of the language or API.
You must use setters.

Michael.

Reply by email