Board index » cppbuilder » Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0

Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0

Hello,

I've just migrated from C++Builder 3 to C++Builder 4 and now there's a
big problem with the new property OldCreateOrder:
I change the value of that property fom true to false in a TForm or in
TDataModule, save and close the project. When I open that project again
and edit the same TForm or TDataModule, the property OldCreateOrder has
the value true again - it's not possible to set and save that property!
How I can I solve this problem? For my project it is important to set
OldCreateOrder to false.

Thanks in advance,
    Thomas

 

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


: Thomas Neumeier <neume...@sigma-gmbh.de> wrote:

Quote
>When I open that project again
>and edit the same TForm or TDataModule, the property OldCreateOrder has
>the value true again

Do you use visual form inheritance in the forms / datamodules where that
happens?

Quote
>For my project it is important to set OldCreateOrder to false.

Let's put it this way: if you cleaned up your source code and moved all
initialisation code out of OnCreate and instead into a proper constructor,
then you wouldn't have this problem.

--
General information:
  * Post to the right group - http://www.borland.com/newsgroups/
    * Do not cross- or multipost
      * Research at http://www.mers.com/searchsite.html

Stefan Hoffmeister - http://www.econos.de/
(TeamB - http://www.teamb.com/)

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


"Stefan Hoffmeister (TeamB)" schrieb:

Quote
> : Thomas Neumeier <neume...@sigma-gmbh.de> wrote:

> >When I open that project again
> >and edit the same TForm or TDataModule, the property OldCreateOrder has
> >the value true again

> Do you use visual form inheritance in the forms / datamodules where that
> happens?

Yes I've used visual form inheritance.

Quote
> >For my project it is important to set OldCreateOrder to false.

> Let's put it this way: if you cleaned up your source code and moved all
> initialisation code out of OnCreate and instead into a proper constructor,
> then you wouldn't have this problem.

Is that really the only way, to solve that problem! We would have to adapt 500
files.

Quote

> --
> General information:
>   * Post to the right group - http://www.borland.com/newsgroups/
>     * Do not cross- or multipost
>       * Research at http://www.mers.com/searchsite.html

> Stefan Hoffmeister - http://www.econos.de/
> (TeamB - http://www.teamb.com/)

Thomas Neumeier

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


: Thomas Neumeier <neume...@sigma-gmbh.de> wrote:

Quote
>Is that really the only way,

No, it is not the only way, but in my humble opinion

* it is the right way
* the fastest way
* a future-proof way

Yes, you can somehow solve your problem with OldCreateOrder by toggling
the switch in the base form, then save and close the base form, then the
project, then do that for every other form, too. I am sorry for being
vague, but I have never had any problems with OldCreateOrder.

The key to solving your problem is to get the IDE to save the value of
OldCreateOrder in your *base* form's form file.

Or you solve the problem the right way (see above).

--
General information:
  * Post to the right group - http://www.borland.com/newsgroups/
    * Do not cross- or multipost
      * Research at http://www.mers.com/searchsite.html

Stefan Hoffmeister - http://www.econos.de/
(TeamB - http://www.teamb.com/)

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


On Tue, 28 Dec 1999 13:14:00 +0100, Thomas Neumeier

Quote
<neume...@sigma-gmbh.de> wrote:
>> >For my project it is important to set OldCreateOrder to false.

>> Let's put it this way: if you cleaned up your source code and moved all
>> initialisation code out of OnCreate and instead into a proper constructor,
>> then you wouldn't have this problem.

>Is that really the only way, to solve that problem! We would have to adapt 500
>files.

He's trotting out the Borland 'party line' on this, as he has been
ever since the bug was found (if he has any pull with Borland, getting
the bug fixed would be of more use).

Override the Loaded() method of your base form (the one derived
directly from TForm) as:

void __fastcall TDerivedForm::Loaded (void)
{
        TForm::Loaded();
        OldCreateOrder = false;

Quote
}

That will do the trick.

Pete Barrett

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


The way i solve this problem when using form inheritance is to overload the
Loaded method in the base form and set the OldCreateOrder to false there.

Like this

void __fastcall TBaseForm::Loaded()
{
    TForm::Loaded();
    OldCreateOrder = false;

Quote
}

This makes everything OK at runtime, although at design time, the property
can still be set to true.

Hope this helps,
Matt

Quote
"Thomas Neumeier" <neume...@sigma-gmbh.de> wrote in message

news:3868A988.5325C858@sigma-gmbh.de...
Quote

> "Stefan Hoffmeister (TeamB)" schrieb:

> > : Thomas Neumeier <neume...@sigma-gmbh.de> wrote:

> > >When I open that project again
> > >and edit the same TForm or TDataModule, the property OldCreateOrder has
> > >the value true again

> > Do you use visual form inheritance in the forms / datamodules where that
> > happens?

> Yes I've used visual form inheritance.

> > >For my project it is important to set OldCreateOrder to false.

> > Let's put it this way: if you cleaned up your source code and moved all
> > initialisation code out of OnCreate and instead into a proper
constructor,
> > then you wouldn't have this problem.

> Is that really the only way, to solve that problem! We would have to adapt
500
> files.

> > --
> > General information:
> >   * Post to the right group - http://www.borland.com/newsgroups/
> >     * Do not cross- or multipost
> >       * Research at http://www.mers.com/searchsite.html

> > Stefan Hoffmeister - http://www.econos.de/
> > (TeamB - http://www.teamb.com/)

> Thomas Neumeier

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


Quote
> big problem with the new property OldCreateOrder:

Have you checked out the free utility found on the Turbopower web site:

http://www.turbopower.com

+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
| http://www.buddydog.org                           |
+===================================================+

There comes a time when you have to face the fact that
Dad has forgotten how to do algebra. -- Pam Brown

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


: "Matt Lee" <nospam@nospam> wrote:

Quote
>void __fastcall TBaseForm::Loaded()
>{
>    TForm::Loaded();
>    OldCreateOrder = false;
>}

While this is certainly a valid work-around, note that the correct fix is
about as costly - and it is a fix.

--
General information:
  * Post to the right group - http://www.borland.com/newsgroups/
    * Do not cross- or multipost
      * Research at http://www.mers.com/searchsite.html

Stefan Hoffmeister - http://www.econos.de/
(TeamB - http://www.teamb.com/)

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


Quote
>Yes I've used visual form inheritance.

A couple of comments:

1- OldCreateOrder affects more than just OnCreate. It can also cause OnShow
to occur before you expect it to. the culprit is the DoCreate member
function of TForm.

procedure TCustomForm.DoCreate;
begin
  if Assigned(FOnCreate) then
  try
    FOnCreate(Self);
  except
    Application.HandleException(Self);
  end;
  if fsVisible in FFormState then Visible := True; // << here
end;

Setting Visible to true triggers OnShow. It might trigger some other stuff
to. So not only do you need to avoid OnCreate, you need to avoid OnShow as
well. This is a big bummer.

2- When you don't use form inheritance, you can simply set OldCreateOrder to
false. With form inheritance, you will find that the IDE will not keep your
setting.

3- With respect to OnCreate, it is best, if possible to move that code to
the constructor

4- What about OnShow???

5- If you work with a large group of programmers, it may be difficult
convincing all of them to give up OnCreate and OnShow. What happens when you
go on vacation, or when you move on to the next high paying job? Who's going
to baby sit when you are not around? I suggest that you add a method to
forms that you put in the object repository. Override the methods that
stream in the properties for the form, and hardcode OldCreateOrder to false.

void __fastcall TBaseForm::ReadState(TReader* Reader)
{
    OldCreateOrder = false;
    TForm::ReadState(Reader);
    OldCreateOrder = false;

Quote
}

That first assignment may not be necessary. I took an aggressive stance
against the property.

Someone else suggested the same thing, but they set the property from
Loaded. I don't know if it matters. I don't remember why I chose ReadState.
Maybe it causes the Object inspector to display false like it should? Maybe
not. TCustomForm::ReadState is where a lot of this trouble starts.

I ended up using this strategy mostly because of OnShow problems, and not
OnCreate.

Harold Howe [TeamB]
http://www.bcbdev.com

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


Stefan Hoffmeister (TeamB) schrieb:

Quote
> Let's put it this way: if you cleaned up your source code and moved all
> initialisation code out of OnCreate and instead into a proper constructor,
> then you wouldn't have this problem.

I don't think the constructor should be used to do all the
initialization work. For example, I have an app where in OnCreate I read
some registry information. If the info isn't there I quit the app. The
only way I see to accomplish this within the constructor would be to
throw an exception (argh). Do you see a different way?

Regards

Martin Golm
Reico GmbH

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


: Reico GmbH <Entwickl...@reico.de> wrote:

Quote
>I have an app where in OnCreate I read
>some registry information. If the info isn't there I quit the app. The
>only way I see to accomplish this within the constructor would be to
>throw an exception (argh). Do you see a different way?

The correct way, believe it or not, is to throw an exception in the
constructor.

--
General information:
  * Post to the right group - http://www.borland.com/newsgroups/
    * Do not cross- or multipost
      * Research at http://www.mers.com/searchsite.html

Stefan Hoffmeister - http://www.econos.de/
TeamB - http://www.teamb.com/

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


I have been fighting this problem for quite some time.  I HAVE put ALL my
create stuff in the "proper constructor" but I stll have a problem.  The
problem is that OldCreateOreder also affects the destruct order too!  I have
not been able to find a solution to this.

I have tried changing OldCreate in all forms and then saving the project and
reloading it but that does not work.  I also tried changing the base forms,
saving, reloading, changing the inherited forms, saving, reloading...  That
does not work either.  Isn't someone at Borland working on a patch for
this??

I also have the general question that if "OnCreate" and "OnShow" (and
presumably OnDestroy) are not to be used, then why are they provided?  And
what is the alternative to OnShow?  The stuff that normally goes into OnShow
usually cannot be moved into OnCreate or the constructor so where does it
get moved so it will work??

David Schilder

Re:Problems with OldCreateOrder when upgrading from BCB 3.0 to BCB 4.0


I Tried this utility and it did NOT fix my problem.  First time I opend the
inherited form after running the converter, OldCreateOrder was set to true
again.

Anybody else got any ideas??

Dave Schilder

Quote
Jonathan Arnold <jdarn...@buddydog.org> wrote in message

news:3869FA97.2FD13BDB@buddydog.org...
Quote
> > big problem with the new property OldCreateOrder:

> Have you checked out the free utility found on the Turbopower web site:

> http://www.turbopower.com

> +===================================================+
> | Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
> | http://www.buddydog.org                           |
> +===================================================+

> There comes a time when you have to face the fact that
> Dad has forgotten how to do algebra. -- Pam Brown

Other Threads