Grups de Google ja no admet publicacions ni subscripcions noves de Usenet. El contingut antic es pot continuar consultant.

BCB4 OldCreateOrder terror

6 visualitzacions
Ves al primer missatge no llegit

Bert Buikema

no llegida,
14 de juny 2000, 3:00:0014/6/00
a

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

no llegida,
14 de juny 2000, 3:00:0014/6/00
a
> 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)

no llegida,
14 de juny 2000, 3:00:0014/6/00
a
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

no llegida,
16 de juny 2000, 3:00:0016/6/00
a
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 missatges nous