CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BCB1] Forms



> I have a dialog box which I create at runtime. I've been looking at
> this from all sides now, but I'm just getting confused.
> 
> When either the OK or CANCEL buttons are clicked, is the form
> destroyed or should I destroy the form myself?  The thing is I get
> to call the same form multiple times and somehow I'm running out of
> handles.

If I understand your question (trying not to assume I do), the form 
gets destroyed but the resource is not freed unless you delete the 
pointer to the form.  For example:

Form2 = new TForm2(Application);
Form2->ShowModal();
delete Form2;

In this case the Form2 gets destroyed when a button with a 
ModalResult is clicked or the form is explicitly closed with a 
Close() method.

You can test this by placing a call to a message box in the OnDestroy 
event of the dialog form.

Michael Trier
Developer's Corner Journal
http://www.pobox.com/~dcj/journal
mailto:mtrier@pobox.com
-----------------------------
Actual News Headlines:
  Enfields Couple Slain; Police Suspect Homicide


W Komornicki's Home Page | Main Index | Thread Index