Var
TempForm: array of TForm2;
Procedure TForm1.Button2Click (Sender: TObject );
Var
I: Integer;
BNew: Boolean;
Begin
BNew: = True;
For I: = Low (TempForm) to High (TempForm) do
Begin
IF TempForm [I]. Caption = Trim (Edit1.Text) then
Begin
TempForm [I]. Show;
BNew: = False;
Exit;
End;
BNew: = True;
End;
IF bNew then
Begin
SetLength (TempForm, Length (TempForm) + 1); // Add a value to the data
TempForm [High (TempForm)]: = TForm2.Create (nil); // create a form
TempForm [High (TempForm)]. Caption: = Trim (Edit1.Text); // The Form Caption is assigned to a value to lock
Self. CheckListBox1.Items. Add (Trim (Edit1.Text ));
TempForm [High (TempForm)]. Show; // the maximum value of the array is the currently created form.
End;
End;
Procedure TForm1.Button3Click (Sender: TObject );
Var
I: integer;
BName: String;
Begin
For I: = 0 to CheckListBox1.Count-1 do
Begin
If CheckListBox1.Selected [I] then
BName: = CheckListBox1.Items. Strings [I];
End;
For I: = Low (TempForm) to high (TempForm) do
Begin
If TempForm [I]. Caption = bName then
Begin
TempForm [I]. Edit1.text: = Edit2.text;
End;
End;
End;