Discussion:
Dynamic forms in delphi
(too old to reply)
remo
2005-03-14 21:53:55 UTC
Permalink
Hello I have a problem with creating dynamic forms in my program. Do do it
do I have to create form manaly at project and remove it in dpr file?

Thanks for help
Maarten Wiltink
2005-03-14 22:26:01 UTC
Permalink
Post by remo
Hello I have a problem with creating dynamic forms in my program.
Do do it do I have to create form manaly at project and remove it
in dpr file?
Much as I dislike to say it, your English is getting in the way
of my understanding.

Yes, when dynamically creating forms, they should not be created
from the project file. That's the whole point. The "correct" way
of removing the auto-creation code is to move the forms to the
other list in the project options. Editing the project file by
hand is safe if you know what you're doing. If you have to ask,
it isn't.

If a form should be instantiated only once, you probably should
store a reference to the singleton in the unit form variable -
and clear it when the form closes. This requires an OnClose handler.
If many independent instances may exist, this does not suffice. On
the other hand, sometimes you don't need to keep track of your
forms at all and if nothing else there's always Windows.Forms[].

Groetjes,
Maarten Wiltink
Noel
2005-04-13 20:24:05 UTC
Permalink
Post by remo
Hello I have a problem with creating dynamic forms in my program. Do do it
do I have to create form manaly at project and remove it in dpr file?
Go to Options on the Project menu and remove the form from the Auto
Create Forms box. Then create it manually like this:

var
F : TMyForm;

begin
F := TMyForm.Create (Application);
F.Show;
.....
end;

Loading...