eg.
FORM1中有一个EDIT,FORM2中有一个LISTBOX,要双击EDIT就出现FORM,并在FORM2的LISTBOX的LIST中加入FORM1.EDIT.TEXT,关闭FORM2时,使FORM1.EDIT的值为FORM2.LISTBOX中的值,

解决方案 »

  1.   

    FORM2:
    ...
    public
      constructor create(AOwner: TComponent; AStr: string); reintrodure;
    ...
    constructor TForm1.create(AOwner: TComponent; AStr: string);
    begin
      inherited create(AOwnner);  ListBox1.ItemsListBox1.Items.Append(AStr); 
    end;procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      if ListBox1.ItemIndex >= 0 then
        Form1.Edit1.Text := ListBox1.Items[ListBox1.ItemIndex]
    end;FORM1:
    procedure TForm1.Edit1DblClick(Sender: TObject);
    var
      Form2: TForm2;
    begin
      Form2 := TForm2.create(self, Edit1.Text);
      Form2.Show;
    end;其中两个单元之implementation要users彼此
      

  2.   

    constructor TForm1.create(AOwner: TComponent; AStr: string);
    写错了,其应为Form2的,即:
    constructor TForm2.create(AOwner: TComponent; AStr: string);
      

  3.   

    我试试 
    reintrodure;
    这个是什么意思啊,我很菜
      

  4.   

    窗口一中Edit的双击事件
    procedure TForm1.Edit1DblClick(Sender: TObject);
    begin
            form2.ListBox1.Items.Add(edit1.Text);
            form2.show;
    end;窗口二中的关闭事件
    procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
             if form2.ListBox1.ItemIndex>=0 then
                 form1.Edit1.Text:=Listbox1.Items[Listbox1.ItemIndex];
    end;
      

  5.   

    我真是越来越迷糊了,reintroduce也写错,Sorry,那些代码也是随手所写,错误真是不少!reintrodure->reintroduce 是指在类的继承中重载父类的方法而避免引起编译警告,论其功能,和override+overload差不多,是这样的;若单以override则不能改变参数个数及类型,单以overload则又不能继承父类相应功能,于是就出现了这个关键字,字面意思为'重介绍'