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

BCB4 OldCreateOrder terror

6 views
Skip to first unread message

Bert Buikema

unread,
Jun 14, 2000, 3:00:00 AM6/14/00
to

I have ported an application from BCB3 to BCB4 and now I am stuck with over 40 TForms where the OldCreateOrder property is forced to 'true' by BCB4. If I set it to false, save the changes, close and reopen the unit, it is set back to 'true', and subsequently the OnShow and OnActivate handlers are executed BEFORE the constructor, and the base-class form constructor. Who knows a solution? (BTW: BCB5 behaves similarly!).


Jonathan Arnold

unread,
Jun 14, 2000, 3:00:00 AM6/14/00
to
> and subsequently the OnShow and OnActivate handlers are executed BEFORE the
> constructor, and the base-class form constructor. Who knows a solution? (BTW:
> BCB5 behaves similarly!).

The consensus is that you should never depend on this flag, and thus never use
OnCreate or OnDestroy. Use the constructor / destructor instead.

That being said, Turbopower has a free utility to fix this for you. Check out
http://www.turbopower.com

+====================================================+
| Jonathan Arnold (mailto:jdar...@buddydog.org) |
| Havas Interactive HyperStudio Engineer |
| http://www.buddydog.org http://www.hyperstudio.com |
+====================================================+

To his dog, every man is Napoleon; hence the constant
popularity of dogs. -- Aldous Huxley

Harold Howe (TeamB)

unread,
Jun 14, 2000, 3:00:00 AM6/14/00
to
Bert Buikema wrote:
>
> I have ported an application from BCB3 to BCB4 and now I am stuck with over 40 TForms where the OldCreateOrder property is forced to 'true' by BCB4. If I set it to false, save the changes, close and reopen the unit, it is set back to 'true',

Are you by chance using form inheritance and the object repository? If so, simply
changing OldCreateOrder to false is not enough. It manages to become true again,
somehow. (due to a bug IMO).

Add this code to the base forms in the repository. This should squash the
OldCreateOrder problem for forms that are inherited. The following is a copy of
something I posted a long time ago.

<quote>
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;
}

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.
</quote>

In this example, TBaseForm is a base class form in the object repository.

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

Martin Hart

unread,
Jun 16, 2000, 3:00:00 AM6/16/00
to
Absolutely correct. I battled with this for some time... to no avail!!

Use the constructors and destructors instead :-))

--
Martin Hart
-----------------
mar...@memorysoft.es
www.memorysoft.es
"Jonathan Arnold" <jdar...@buddydog.org> escribió en el mensaje
news:39477D63...@buddydog.org...

0 new messages