views:

44

answers:

0

Some time ago I developed a component that had TCollection descendant property and items from this collection contained referenced to the controls on the form. Everything was ok with this component except for inheritance. I don't know about the latest versions of Delphi, but with older ones when a collection is inherited there were two variants possible: full inheritance from the ancestor (if there was no single change in descendant) or once copied then lived separately (if something was changed). The problem was that for such components (with references to other components in collection's items) Delphi always chose former variant so once you make an inherited form, you won't be able to keep the ancestor collection the same in the descendant (even if you didn't touch a thing).

As I recall from the learning VCL sources the code logic relied on the result from CollectionsEqual procedure that formally was right. It looked like in the time of saving forms it compared them binary and sure the references had different binary values (there are separate copies of the ancestor and descendant forms when Delphi compares them for saving)

So what you think, can it be considered a bug or a misfeature we should live with? And maybe some latest versions finally fixed this? Actually I found a workaround (a property that being set in the parent form forces "not saving" in the descendant), but it would be better to have more consistent logic on the VCL side

Thanks,

Max