Einzelnen Beitrag anzeigen

pastra

Registriert seit: 23. Jun 2006
21 Beiträge
 
#4

Re: How to create Eg. Ten instaces of the same form?

  Alt 14. Jul 2006, 18:15
Zitat von Dax:
Well, first: do not use the global var Form1 in the Form's Unit anymore. Rather use self when you are in the same Unit. If you want to use these Forms from other Forms or Units, you must create a new global var of type array[1..10] of TForm1 to hold the ten Forms for access from outside themselves.

After that, you need an activation-procedure to create an show all the Forms, maybe like this:
Delphi-Quellcode:
procedure ShowAllForms;
var
  i: Integer;
begin
  for i := 1 to 10 do
  begin
    Forms[i] := TForm1.Create(Application); // Forms is your array
    Forms[i].Show;
  end;
end;
When done, you can access the Forms through their index

Okay this code look interresting... When trying to compile in (D6) i get: '.' expected but [ found at: Forms[

What am I dooing wrong? Do I need to define some unit in the USES clase?


Creers!
  Mit Zitat antworten Zitat