Article View: borland.public.cppbuilder.upgrade
Article #2283Upgrade 3.0 to 5.0, TForm constructor problem
From: David Bridges
Date: Fri, 24 Mar 2000 00:00
Date: Fri, 24 Mar 2000 00:00
18 lines
1610 bytes
1610 bytes
In C++ Builder 3.0, when you have forms derived from TForm, the constructor always gets called before the OnCreate() event gets generated. The only exception was when you read a property in the constructor that caused the form to be "created", i.e. reading the 'Handle' property. C++ Builder 4.0/5.0 seems to have "fixed" this by generating the OnCreate event in the TForm constructor. Anyway, here's the point of all of this: I have many forms which take parameters in the constructor which are stored into variables in the class. Then "later", in the FormCreate() function, those variables are used to do stuff like read tables, etc. All of this code is now broken after converting to 5.0 - It seems my only solution is to move all of the FormCreate() code into the constructors. This is a pain, but oh well... Has anyone else had this problem and/or found a workaround for it? P.S. Yes, I know the documentation said never to use both the constructor and OnCreate event to do stuff, I but chose to ignore it...
Technical Details
Message-ID:
<38dc013b@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10529a,28574c7a2f9d33f6,start X-Google-Attributes: gid10529a,public From: "David Bridges" <bridges@advpubtech.com> Subject: Upgrade 3.0 to 5.0, TForm constructor problem Date: 2000/03/24 Message-ID: <38dc013b@dnews> X-Deja-AN: 602002232 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Trace: 24 Mar 2000 15:58:51 -0800, 63.212.128.216 Organization: APT X-MSMail-Priority: Normal Reply-To: "David Bridges" <bridges@advpubtech.com> Newsgroups: borland.public.cppbuilder.upgrade