On 16.01.2011 17:18, Hans-Peter Diettrich wrote:
Graeme Geldenhuys schrieb:
Lets say the Form unit is called frm_main.pas, it will have a structure
as follows:
[...]
This code is not very compatible with the new AutoSize, and may cause
other problems.
But this should not be a problem, as long as the code generator and LCL
is provided and maintained by the same "authority".
AfterCreate is a virtual method that gets called in a base form class in
the AfterConstructor method.
What about code in FormCreate?
You will also notice that the UI components are placed inside the
Private section of the Form class. You can move it to any other pricacy
section if you please. I simply apply standard OOP practises here, just
like what you would do in business objects... Only make visible what you
really want visible.
A reasonable point! :-)
Nonetheless the visibility of the component properties cannot be reduced
much. It must stay public, so that the properties are accessible in
AfterCreate. The same with Frames...
You are aware that Graeme talks about fpGUI and not the LCL?
In fpGUI there is no "new AutoSize" and also there is no "FormCreate",
because in fpGUI the convention is to create controls in "AfterCreate"
which is a virtual method and not an event. Also fpGUI does not rely on
component streaming and thus the visibility of component fields can be
as low as private without problems.
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus