How to implement an OnAfterExecute event in a TActionList #205

Question
In a TActionList, there is an event OnExecute, which is called before executing an action. Now I would like to enhance TActionList with an event OnAfterExecute, which is called when the execution of any action is finished. I looked at the VCL code, but for me it's not clear, where and how to add this feature in a subclass of TActionList.
unit MyActionList;
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ActnList;
 
type
  TMyActionList = class(TActionList)
  private
    FOnAfterExecute: TActionEvent;
    SOnExecute: TActionEvent;
  protected
    procedure Loaded; override;
    procedure DoOnExecute(Action: TBasicAction; var Handled: Boolean);
  published
    property OnAfterExecute: TActionEvent 
      read FOnAfterExecute write FOnAfterExecute;
  end;
 
procedure Register;
 
implementation
 
procedure Register;
begin
  RegisterComponents('Samples', [TMyActionList]);
end;
 
{ TMyActionList }
 
procedure TMyActionList.DoOnExecute(Action: TBasicAction; var Handled: Boolean);
begin
  if Assigned(SOnExecute) then
  begin
    SOnExecute(Action, Handled);
    if Assigned(OnAfterExecute) then
      OnAfterExecute(Action, Handled);
  end;
end;
 
 
procedure TMyActionList.Loaded;
begin
  inherited;
  SOnExecute := OnExecute;
  OnExecute := DoOnExecute;
end;
 
end.
Original resource: The Delphi Pool
Author: Igor Glukhov
Added: 2013/01/27
Last updated: 2013/01/27