You could just add a new constructor:
TmyForm=class(Tform)
protected
myParameter:integer;
public
constructor myCreate(anOwner:Tcomponent;aParameter:integer);
end;
or you could overload create:
TmyForm=class(Tform)
protected
myParameter:integer;
public
constructor Create(anOwner:Tcomponent;aParameter:integer);
reintroduce; overload;
end;
in either case, call the inherited create:
constructor myForm.create(anOwner:Tcomponent;aParameter:integer);
begin
inherited create(anOwner);
myParameter:=aParameter;
end;
Then you can instantiate myForms:
thisForm:TmyForm;
thisForm:=TmyForm.create(self,5);
Rgds,
Martin
I believe I saw something recently that this way of creating your instance
of TmyForm could (will?) fail if it is actually dropped on the mainform and
as such created automatically during mainform.create. I don't remember
the details, but there was something to the effect that your "private"
constructor is not called in such cases, only the "inherited" constructor
"create" is called.
Better investigate, I hope for your sake that I am wrong.
regards Sven
Woudn't be suprised. I've only ever considered using overloaded form
constructors when dynamically creating the forms at runtime.
Rgds,
Martin