回 帖 发 新 帖 刷新版面

主题:[讨论]通过调用某事件的处理函数,模拟该事件发生,错在哪里?

下一函数是OnClose事件的处理函数
procedure Tmain_Form.FormClose(Sender: TObject; var Action: TCloseAction);

begin
  if MessageDlg('Close application ?', mtConfirmation,
    [mbYes, mbNo], 0) = mrYes then
    Action := caFree
  else
    Action := caNone;
end;
下面是在一菜单单击
procedure Tmain_Form.N14Click(Sender: TObject);
var Action: TCloseAction ;//type TCloseAction = (caNone, caHide, caFree, caMinimize);
begin
   main_Form.FormClose(main_Form,Action);
   //main_Form.OnClose(main_Form,Action);
end;
单击后对话框有,但没有关闭窗体.错在哪?

回复列表 (共1个回复)

沙发


我已解决.

我来回复

您尚未登录,请登录后再回复。点此登录或注册