我的mdi窗体退出时,出现abstract问题如果进入mdi窗体后,不做任何操作就退出,没有这个问题,
如果调用一个子窗体后,再退出就会出现这个问题
调用子窗体代码
 if Screen.ActiveForm <> nil then
    begin
      if Screen.ActiveForm.FormStyle = fsMDIChild then
      begin
         if Pos(Rightstr(Screen.ActiveForm.Name,1),'0123456789') = 0 then
                begin
                  Screen.ActiveForm.Close ;
                  Screen.ActiveForm.Free ;
      
                end ;
           end ;
         end;        if Frm_query = nil then
          begin
               application.CreateForm(TFrm_query,Frm_query);
               Frm_query.show ;
           end ;子窗体退出代码
button1click
close;formclose 
Action := caFree ;FormDestroy
form1 := nil ;为什么会有这个问题啊???
我应该没有用到什么虚拟东东

解决方案 »

  1.   

    FormDestroy
    form1 := nil ;这两句不要。
      

  2.   

    formDestroy 是 form 的Destroy事件
    我的destroy事件 中的代码是
    form1 := nil ;我上面写的formclose 是 close事件.
      

  3.   

    创建
        if not Assigned(Form1) then
            Application.CreateForm  (TForm1 ,Form1 );子窗体 OnClose
          Action := caFree ;
        Form1 := nil;
      

  4.   

    if Pos(Rightstr(Screen.ActiveForm.Name,1),'0123456789') = 0 then
    改为
             if Screen.ActiveForm.MDIChildCount = 0 then
    试试。
      

  5.   

    应该是判断主窗口是否有未关闭的子窗体:
    if fmMain.MDIChildCount = 0 then
    执行关闭主窗体操作。