我用一个FORM1动态创建多个FORM2,FORM2的名字不同;
在另一个静态FORM3中能否判断一个特定FORM2是否被创建?

解决方案 »

  1.   

    if assigned(form2) then
      showmessage('form2 already be created');
      

  2.   


      if FormA = Nil then
         FormA:= TForm2.Create(FormA);
      FormA.WindowState := wsNormal;
      FormA.Show;
      

  3.   

    在Form2创建指定Owner为Form1,form2 := TForm2.Create(Form1);
    在Form3中:
    if Assigned(Form1.FindComponent('Form2的名字')) then
      ShowMessage('Form2的名字 已被创建');
      

  4.   

    忘记说了,我的FORM1也是动态的,在创建FORM2后关闭了
    就象QQ接受消息后的回复一样
      

  5.   

    那就指定Owner为Application,form2 := TForm2.Create(Application);
    在Form3中:
    if Assigned(Application.FindComponent('form22')) then
      ShowMessage('form22已被创建');
      

  6.   

    弱弱的问一个,如果我要改变FORM2的名字怎么写?比如写成这样的 11sendform
    form2.name:=edit1.text+'sendform'?不是这样吧
      

  7.   

    to  sysu(死树) :昨天我问的那个是对齐控件显示popmenu,你给的第一个是对的 3X
      

  8.   

    名字的第一个字母只能是英文字母或是下划线:
    form2.name:='sendform'+edit1.text;
      

  9.   

    还是不行,不知道错在哪里了//form1  
      form2:=Tform2.Create(application);
      form2.Show;
      self.Close;//form2
      form2.name:='form'+edit1.text;//form3
     if Assigned(Application.FindComponent('form'+edit1.text))) then showmessage (inttostr(edit1.text));
      

  10.   

    应该可以的,你form2和form3中的edit1.text的值要一样才能找到,
    还有form3中有点错:
    if Assigned(Application.FindComponent('form'+edit1.text)) then showmessage (edit1.text);