Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Aborting a Create()

35 views
Skip to first unread message

Neal

unread,
Oct 27, 1999, 3:00:00 AM10/27/99
to
How can I abort the creation of a form, from inside of the FormCreate
method?

I want to build a class that is smart enough to know if it should create
itself.


Neal

Steve Zimmelman

unread,
Oct 27, 1999, 3:00:00 AM10/27/99
to
I believe the OnCreate event actually takes place just after the Form is
created, so that is probably not the place to abort. You might think about
creating a class that controls the creation of other classes based on
whatever criteria you see fit. That would make more sense than to try to
abort a creation in the creation event.

-Steve-

Neal <ne...@msengineering.net> wrote in message
news:7v7qf1$mj...@forums.borland.com...

Wayne Niddery (TeamB)

unread,
Oct 27, 1999, 3:00:00 AM10/27/99
to
Neal wrote in message <7v7qf1$mj...@forums.borland.com>...

>How can I abort the creation of a form, from inside of the FormCreate
>method?
>
>I want to build a class that is smart enough to know if it should create
>itself.

Don't call Create unless you want it created. Once the process is started,
it is difficult to stop it because a lot of processes are involved (both in
your code and within Windows).

Create a method in this form that you can call instead, that method can
*first* check the criteria and only Show the form if required.

--
Wayne Niddery - WinWright Consulting
RADBooks - http://members.home.net/wniddery/
You have a Right to Free Speech, but not the right to make me listen, nor to
use my property as your soapbox.

Xavier Pacheco (TeamB)

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
Neal,
As Steve mentioned, the OnCreate occurs after the form is created.
Do this, override the create constructor, then abort before calling
inherited Create(). This will prevent the form from being created.
--- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Tim Jarvis

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
Raising an exception in the constructor will abort the construction. That
way you can handle the exception in the function that is creating the form
if required.

Rgds Tim.

Xavier Pacheco (TeamB)

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
Actually, you can even raise a silent exception such as EAbort.

Neal

unread,
Oct 28, 1999, 3:00:00 AM10/28/99
to
I tried creating an overridden TForm.Create() method, but Delphi didn't like
the signature. I was unable to figure out the signature of the Create() is.

SO...what would the signature (prototype) of the TForm.Create() method look
like?

THanks,

Neal

Xavier Pacheco (TeamB) wrote in message
<381893e6...@forums.inprise.com>...


>Neal,
> As Steve mentioned, the OnCreate occurs after the form is created.
>Do this, override the create constructor, then abort before calling
>inherited Create(). This will prevent the form from being created.

Tim Jarvis

unread,
Oct 29, 1999, 3:00:00 AM10/29/99
to
In the public section

Constructor Create(Owner : TComponent);Override;

Rgds Tim.

Neal <ne...@msengineering.net> wrote in message

news:7vaafi$cg...@forums.borland.com...

0 new messages