procedure TMainForm.ApplicationEventsActionExecute(Action: TBasicAction;
  var Handled: Boolean);
begin
  showmessage('Event OnActionExecute');
end;从来就没有被执行过。

解决方案 »

  1.   

    在form上放着一个button,applicationevents,actionlist控件,增加一个action到actionlist中,action1没有实现onexecute函数,设置button1的action属性为action1。发现button1的按钮式灰色的。。源代码如下
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ActnList, AppEvnts;type
      TForm1 = class(TForm)
        ApplicationEvents1: TApplicationEvents;
        ActionList1: TActionList;
        Action1: TAction;
        Button1: TButton;
        procedure ApplicationEvents1ActionExecute(Action: TBasicAction;
          var Handled: Boolean);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.ApplicationEvents1ActionExecute(Action: TBasicAction;
      var Handled: Boolean);
    begin
                    showmessage('execute');
    end;end.可是如果给action1增加了onexecute函数
    procedure TForm1.Action1Execute(Sender: TObject);
    begin
            ;;
    end;
    哪怕是空语句
    procedure TForm1.ApplicationEvents1ActionExecute(Action: TBasicAction;
      var Handled: Boolean);
    begin
                    showmessage('execute');
    end;
    事件就会被触发!
    可是帮助手册上不是说,onactionexecute是当组件的动作列表中没有定义OnExecute的事件处理程序时,对组件的OnExecute事件进行响应 。
    这个好像恰恰相反!!!
      

  2.   

    他说的是不处理,不是不定义,当然指的是ActionManger,而不是Action