Salut Bart Broersma !
Dans un message de Bart Broersma dat‚ du 22 Mar 97 12:07:02 il ‚tait dit:
BB> Hallo everyone out there,I'm fairly new to Delphi, although I've had
BB> some years experience in TP 6.0.Here's something I don't quite
BB> understand.Say I have a simple apllication (Delphi 1.0), with Form1 as
BB> the main form.Now I add another form (Form2) to this project, lets say
BB> something like an AboutBox or a simple Ok/Cancel dialog.Now, what is
BB> the proper way to show this form, which syntax is correct ?1. ...
BB> Form2.SomeProperty := SomeValue; Form2.ShowModal; if Form2.ModalResult
BB> = mrOk then ... ...or2. ... Form2 := TForm2.Create(Application);
BB> Form2.SomeProperty := SomeValue; Form2.ShowModal; if Form2.ModalResult
BB> = mrOk then ... ... Form2.Free;Both syntaxes seem to work, so I'm a
BB> little confused here (am I missing some fundamental concept here ?).
Both syntaxes are correct. They are doing two diferent things. The
first is the normal way to show a form wich is created at program
startup.
The second one is the way you can create a new form on the fly. This
is normally used when you have many forms, too many to have them
created automatically at program startup. In the project options, you
can remove a given form from the auto-creation list.
The second way is also used when you need to have more than one
instance of a window. You can create as many forms as you wants and
have all them 'run' at the same time. Fairly usefull for a server with
a form for each client.
Amiti‚s,
{-Francois Piette-}
francois.piette@ping.be
http://www.rtfm.be/fpiette
--- SvFido 1.32
---------------
* Origin: OverByte BBS (Embourg-Belgium) 32-4-3651395 VFC/V34+ (2:293/2202)
|