ActionList的一个Action的OnExecute事件定义如下
procedure TfMMC.closeExecute(Sender: TObject);
begin
close;
end;//TfMMC=class(TForm);怎么都通不过编译
procedure TfMMC.closeExecute(Sender: TObject);
begin
close;
end;//TfMMC=class(TForm);怎么都通不过编译
系统怎么能知道close是要调用你的Action还是要关闭窗口
begin
Self.close;
end;
begin
close;
end;
并不是Close不能用作对象名称,但是,这样你把TForm.Close屏蔽了。而是你上面这句Close,在这个名称空间里,Delphi把它理解为Close对象(TAction)。所以你写Close,他就会告诉你缺少语句,只找到表达式。那么,为了让它把Close理解为Method的调用,你可以procedure TfMMC.closeExecute(Sender: TObject);
begin
inherited Close;
end;不过,这个不是解决的办法,你应该将这个Action改名,例如改为acClose或者acExit,这才是解决的办法