unit myActionList;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ActnList, IniFiles, Stdctrls, Menus;
type
TmyActionList =
class(TActionList)
private
{ Private-Deklarationen }
oAction: TCustomAction;
FOnExecuteAction: TNotifyEvent;
procedure OnActionExecute(Sender: TObject);
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
function ExecuteAction(Action: TBasicAction): Boolean;
override;
published
{ Published-Deklarationen }
end;
var
oCallBackToMemLog : TCallBackEventToMemLog;
implementation
constructor TmyActionList.Create(AOwner: TComponent);
begin
inherited;
oAction :=
nil;
end;
function TmyActionList.ExecuteAction(Action: TBasicAction): Boolean;
begin
if Action
is TCustomAction
then begin
FOnExecuteAction := TCustomAction(Action).OnExecute;
TCustomAction(Action).OnExecute := OnActionExecute;
oAction := TCustomAction(Action);
oAction.Enabled := False;
end;
end;
procedure TmyActionList.OnActionExecute(Sender: TObject);
begin
if Assigned(FOnExecuteAction)
then begin
FOnExecuteAction(Self);
end;
oAction.Enabled := True;
TCustomAction(oAction).OnExecute := FOnExecuteAction;
end;
end.