Rohit Gupta asked us:
> Is there a valid reason why loaded is called twice for a grid thats
> on the ancestor form when you inherit it using the repository ?
This business of Loaded and inherited forms is fun area that causes
endless problems.
In Delphi 3 as each level of inherited form finished streaming its
resources in the Loaded method was called, probably on the theory that
each level's components should be in a good state before loading the nest
level of form. You could detect this situation because the components
stayed with csLoading in ComponenState until the final top level of form
inheritance was loaded, and at that stage it was safe to actually do the
loaded functionality.
In Delphi 4 this situation has changed. Now during each inherited forms
loading process any components streamed in are added to the end of a list
that is traversed once the last form has streamed. Unfortunately if a
component has properties changed in N of the inherited form levels it will
appear N times in the list, and its loaded methods will be called N times!
You can't detect this usine the csLoading state as it is cleared before
the list is processed.
As far as is known Delphi 5 makes no major changes to the streaming
mechanism so we can hope for no relief from that quarter...
So the best solution appears to be that in Delphi 3 you check for the
csLoading flag to be cleared and do your stuff then, while in Delphi 4 you
must keep your own flag and ensure that you do the loaded processing only
once not matter how many times you are called.
The other option is to try and ensure that the Loaded call has no costly
or unfortutate side effects if called more than once.
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz