TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BART BROERSMA
from: HENK HAMERS
date: 1997-03-25 01:29:00
subject: Simple question

Bart Broersma wrote in a message to All:
 BB> Here's something I don't quite understand.
 BB> Say I have a simple apllication (Delphi 1.0), with Form1 as
 BB> the main form. Now I add another form (Form2) to this
 BB> project, lets say something like an  AboutBox or a simple
 BB> Ok/Cancel dialog.
 BB> Now, what is the proper way to show this form, which syntax
 BB> is correct ? 
 BB> 1.
 BB>   Form2.SomeProperty := SomeValue;
 BB>   Form2.ShowModal;
 BB>   if Form2.ModalResult = mrOk then ...
 BB>   ...
 BB> 2.
 BB>   Form2 := TForm2.Create(Application);
 BB>   Form2.SomeProperty := SomeValue;
 BB>   Form2.ShowModal;
 BB>   if Form2.ModalResult = mrOk then ... 
 BB>   ...
 BB>   Form2.Free;
 BB> Both syntaxes seem to work, so I'm a little confused here
 BB> (am I missing  some fundamental concept here ?). 
Yep!!
The first one is the correct one. Why??
Because you earliar stated that you already made the second form 
with the IDE (in design mode).
In that case you don't have to make an new instance to get the form (its 
already created at design time).
In your second case you are making a new form and you will never free up the 
form you created at design time!!
Greetz from limboland, Henk 
--- timEd 1.01
---------------
* Origin: Programming PFFF... (2:285/717.28)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.