On Mon, 9 Jul 2007, Graeme Geldenhuys wrote:
> On 09/07/07, Marc Weustink <[EMAIL PROTECTED]> wrote:
> >
> > And why do you think a form.OnCreate would fire at the right moment ?
> >
>
> Well, using embedded forms at runtime... you create the form when you
> need the form. At which point the OnCreate fires. Frames are meant
> for usage at design time, so you have no control at runtime, as to
> when it was created.
Why not ?
I have extensive experience with embedded forms: we use embedded forms only in
my applications (About 800 forms). I use them since 8 years (in Delphi,
admittedly).
After all that time, I'm in a position to say that we have regretted this
decision
on many occasions.
Unfortunately, Frames did not exist in Delphi when we started our development,
or we would have used them. Unfortunately, we have too much forms meanwhile,
otherwise I would have switched to frames at once.
Many events of TForm simply do not work when the form is embedded:
- OnShow
- OnClose
- OnCloseQuery
- OnKeyPress in combination with KeyPreview
and I forget a lot of them.
Many properties of TForm simply don't make sense when the form is embedded:
formstyle and the like. "Scaled" is the biggest evil around.
With TFrame, on the other hand, you have everything under control.
You can add as many properties or events as you like, and you can
completely define when these events are fired. The 'useless' properties
are not there, so they will not get used erroneously.
So my advice is:
- By all means, stick with TFrame
- Create a TCustomFrame descendent which adds any events/properties you need,
and use that exclusively. Register it in the IDE so you can visually design
it.
Michael.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives