notifier.pas

来自「GREATIS Print Suite Pro for Delphi (3-7,」· PAS 代码 · 共 40 行

PAS
40
字号
(*  GREATIS BONUS * TNotifier                 *)
(*  Copyright (C) 1998-2007 Greatis Software  *)
(*  http://www.greatis.com/delphibonus.htm    *)

unit Notifier;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type

  TNotificationEvent = procedure (Sender: TObject; AComponent: TComponent; Operation: TOperation) of object;

  TNotifier = class(TComponent)
  private
    { Private declarations }
    FOnNotification: TNotificationEvent;
  protected
    { Protected declarations }
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  public
    { Public declarations }
  published
    { Published declarations }
    property OnNotification: TNotificationEvent read FOnNotification write FOnNotification;
  end;

implementation

procedure TNotifier.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited;
  if not (csDestroying in ComponentState) and not (csDesigning in ComponentState) and
    Assigned(FOnNotification) then FOnNotification(Self,AComponent,Operation);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?