Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Created ???

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
Hi all,

Some of my forms are created dynamically, I would like to
know how I can test wether or not it has already been
created.

I need to know this because if I close my app while one of
my dynamically created forms is not freed, I get the next
time I create the (even though the entire app was closed
off) a Win32 API error reffering to a combobox on the form.

If you then kill the app using Windows CTRL-ALT-DEL menu,
and restart the app and then recreate the form all of the
user memory and systems memory is used up (0% available),
weird enough though the GDI memory is around 73% available,
and it makes Windows crash :-(

This does not happen either the form is autocreated or freed
before the app closes off.

So is there basically any way to test wether or not the form
is created ???

Thanx allot, [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Code:
if form <> nil then
...the form has been created.
 
Thanx for your responses guys !!!

I create the form with the app itself as the owner.
I'm going to try mikeEd's IF statement. Sounds like a
good idea !!! [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Do you not have to set the form parameters to NIL before the creates to ensure that they are actually NIL and not set to some spurious address? Also, setting them to nil again after the free.
 
No, you dont have to do that. My forms always show up
correctly. You just set the values you want after it has
been created and you'll be fine. [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
lou: no, you don't. It doesn't matter what the value of the form variable is before you assign a new value to it. It doesn't hurt to set an object to nil after freeing it though, as subsequent calls to Free then won't raise an error.
 
I got a new problem. A form of mine which is dynamically created, can't be closed because I keep getting EAccessViolation at some memory addresses. I have tried all
ways that I know will close a form:

Self.Close;
Self.Free;
Self.Release;

This form is the form that is shown first, although it is
not the mainform (another one containing procedures and
settings that are used by all forms is the mainform).

I don't know why it doesn't let me close it off, because
there are no endless loops or functions that could get
stuck.

I hope you guys have some suggestions on what I could do or
should check out. [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Sorry for that last post guys, I have already figured out
why I got the error. Thanx anyway :) [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top