两个窗体类
祖先类:TFormTestParent
子类:TFormTestChild
在祖先类窗体中有一个BarButton 按钮BarButton_Show,TActionList 里面未加入任何TAction;
在子类中 在 TActionList 加入 Action_Show: TAction , 同时BarButton 按钮 Action属性指定Action_Show ,并且将BarButton 按钮Click 事件指向Action_ShowExecuteprocedure TFormTestParent.BarButton_ShowClick(Sender: TObject);
begin
  cxMemo_Text.Lines.Add('BarButton');
end;procedure TFormTestChild.Action_ShowExecute(Sender: TObject);
begin
  inherited;
  cxMemo_Text.Lines.Add('Action');
end;
点击子类窗体TFormTestChild  上的BarButton 按钮BarButton_Show 
cxMemo 控件中的值为” 'BarButton'” 不是应该是”Action” 吗 ????
继承控件

解决方案 »

  1.   

    你在写
    procedure TFormTestParent.BarButton_ShowClick(Sender: TObject);
     begin
       cxMemo_Text.Lines.Add('BarButton');
     end;
    这个事件的时侯改变了click事件的指向,你是双onclick写的吧
    如果click事件指向Action_ShowExecute 上面的事件是不可能执行的。我试过
      

  2.   

    可能是我描述的不够仔细,抱歉
    BarButton 按钮 Click 事件 是在父类里面处理的
    子类继承父类,然后添加Action_Show: TAction同时BarButton 按钮 Action属性指定Action_Show ,并且将BarButton 按钮Click 事件指向Action_ShowExecute 
    PS: BarButton 按钮 Click 事件 是在父类里面处理的;
     子类直接继承父类,子类并未修改BarButton 按钮Click事件,原封不动的继承父类

    ------------------------------------------------------------------------------
    我并未改变Click 事件的指向,只是将BarButton Click 事件指向Action_ShowExecute而已