......    
if not assigned(MainFM) then
      Application.CreateForm(TMainFM, MainFM)
......procedure TMainFM.N11451Click(Sender: TObject);
begin
  SetMatList;
end;procedure SetMatList;
begin
  if not assigned(MatQueryFM) then      begin
    MatQueryFM := TMatQueryFM.Create(nil);
    MatQueryFM.Show;
  end;
end;其中MainFM是主窗体,MatQueryFM 是子窗体,请问为何调用以后在主窗体中看不到该子窗体呢

解决方案 »

  1.   

    你是不是在OnClose 里写了Actino := caFree;  :)
    把if not assigned(MatQueryFM) then  干掉,  一个程序员最基本的是要学会调试,  这种情况只要单步跟踪就可以发现情况了
      

  2.   

    procedure SetMatList;
    begin
      if not assigned(MatQueryFM) then      
        MatQueryFM := TMatQueryFM.Create(nil);
      MatQueryFM.Show;
    end;
    在OnClose中写
      Action:=CaFree;
      Self := nil;
      

  3.   

    procedure SetMatList;
    begin
      if not assigned(MatQueryFM) then      
        MatQueryFM := TMatQueryFM.Create(Application);
      MatQueryFM.Show;
    end;
    在OnClose中写
      Action:=CaFree;
      Self := nil;
      

  4.   

    我已经在OnClose中写了 
    Action:=CaFree;
      Self := nil;阿
    就是看不到子窗体阿
      

  5.   

    我已经在OnClose中写了 
    Action:=CaFree;
      Self := nil;阿
    就是看不到子窗体阿
      

  6.   

    procedure SetMatList;
    begin
      if not assigned(MatQueryFM) then      
        MatQueryFM := TMatQueryFM.Create(Application);
      MatQueryFM.Show;
    end;
    在OnClose中写
      Action:=CaFree;
      Self := nil;
      

  7.   

    过客,我也这么试了,还是不行啊
    我想问一下,create(nil)和create(application)有什么区别呢
      

  8.   

    过客的方法是不行的(过客兄,  不要打我);
    to:wy_whb() ( ) 
       我不是跟你说了吗把if not assigned(MatQueryFM) then  去掉跟踪一下你会发现它除了第一次为真以后永远为假,  原因就Action := caFree; 加上Self := nil 也不行
    procedure SetMatList;
    begin
      with TMatQueryFM.Create(nil) do Show;
    end;
      

  9.   

    过客的方法是不行的(过客兄,  不要打我);
    to:wy_whb() ( ) 
       我不是跟你说了吗把if not assigned(MatQueryFM) then  去掉跟踪一下你会发现它除了第一次为真以后永远为假,  原因就Action := caFree; 加上Self := nil 也不行
    procedure SetMatList;
    begin
      with TMatQueryFM.Create(nil) do Show;
    end;
      

  10.   

    我发现我的问题的原因了,不是上面两位仁兄说的那样,而是我的主窗体上面有TPanle和TImage,并且都是alClient,所以子窗体都被他们覆盖了看不到
    但是如何在有TImage图片的主窗体上显示子窗体呢?