Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

delphi forms

19 views
Skip to first unread message

tim kingsmill

unread,
Jun 30, 1995, 3:00:00 AM6/30/95
to
Hi

How do I test as if a form exists in delphi. If I call the create method
and a instance of the form already exists a second instance is created.
I do not want to auto create the forms on startup as I am running out of
resources.

See Ya round 8-)

PS please send any replies to my Email address as well as this group.

Ta muchly

Tim Kingsmill.


Steve Koterski

unread,
Jul 1, 1995, 3:00:00 AM7/1/95
to
tim kingsmill (tkin...@eve.adam.com.au) wrote:
: How do I test as if a form exists in delphi. If I call the create method
: and a instance of the form already exists a second instance is created.
: I do not want to auto create the forms on startup as I am running out of
: resources.

One way to do this would be to:

1. Set the Name property for the form after creating it.
2. When calling the Create method of the TForm, use the application's
main form as the owner (as opposed to, say, Application).
3. Then, at run-time, you can use the FindComponent method of the main
form, passing as the argument the name of the form you want to see if
exists. FindComponent returns a value of type TComponent, so if the
search was not successful, the return value will be nil (i.e., that
for has not yet been instantiated).

--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Steve Koterski _/ The opinions expressed here are _/
_/ kote...@borland.com _/ exclusively my own _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

0 new messages