Так:
Код:
unit Unit2;
interface
uses
classes;
type
TMyTestClass = class
private
FBol:boolean;
FOnAfterChangeBol: TNotifyEvent;
FOnBeforeChangeBol: TNotifyEvent;
FOnBeforeReadBol: TNotifyEvent;
FOnAfterReadBol: TNotifyEvent;
function GetBol: boolean;
procedure SetBol(const Value: boolean);
procedure SetOnAfterChangeBol(const Value: TNotifyEvent);
procedure SetOnBeforeChangeBol(const Value: TNotifyEvent);
procedure SetOnAfterReadBol(const Value: TNotifyEvent);
procedure SetOnBeforeReadBol(const Value: TNotifyEvent);
public
property Bol:boolean read GetBol write SetBol;
property OnBeforeChangeBol:TNotifyEvent read FOnBeforeChangeBol write SetOnBeforeChangeBol; //перед изменением
property OnAfterChangeBol:TNotifyEvent read FOnAfterChangeBol write SetOnAfterChangeBol; //после изменения
property OnBeforeReadBol:TNotifyEvent read FOnBeforeReadBol write SetOnBeforeReadBol; //перед чтением
property OnAfterReadBol:TNotifyEvent read FOnAfterReadBol write SetOnAfterReadBol; //после чтения
end;
implementation
{ TMyTestClass }
function TMyTestClass.GetBol: boolean;
begin
if Assigned(FOnBeforeReadBol) then
FOnBeforeReadBol(Self);
Result:=FBol;
if Assigned(FOnAfterReadBol) then
FOnAfterReadBol(Self);
end;
procedure TMyTestClass.SetBol(const Value: boolean);
begin
if Assigned(FOnBeforeChangeBol) then
FOnBeforeChangeBol(Self);
FBol:=Value;
if Assigned(FOnAfterChangeBol) then
FOnAfterChangeBol(Self);
end;
procedure TMyTestClass.SetOnAfterChangeBol(const Value: TNotifyEvent);
begin
FOnAfterChangeBol := Value;
end;
procedure TMyTestClass.SetOnAfterReadBol(const Value: TNotifyEvent);
begin
FOnAfterReadBol := Value;
end;
procedure TMyTestClass.SetOnBeforeChangeBol(const Value: TNotifyEvent);
begin
FOnBeforeChangeBol := Value;
end;
procedure TMyTestClass.SetOnBeforeReadBol(const Value: TNotifyEvent);
begin
FOnBeforeReadBol := Value;
end;
end.
|