In article <✉newsgroups.borland.com>, Brian Cook wrote:
> essence, exactly the same method.
Not true:
procedure TComponent.ValidateContainer(AComponent: TComponent); begin AComponent.ValidateInsert(Self); end;
procedure TComponent.ValidateInsert(AComponent: TComponent); begin end;
Note that in ValidateContainer, self is the component about to be inserted into AComponent, whereas in ValidateInsert, self is the component which AComponent is about to be inserted into. Overriding ValidateContainer has absolutely no effect on the components being inserted into self.
procedure TWinControl.InsertControl(AControl: TControl); begin AControl.ValidateContainer(Self); translates to Self.ValidateInsert(AControl);
> ValidateInsert could actually be removed > from the VCL with no adverse affect. >
If you only use the VCL classes, yes, because it doesn't do anything. It needs to be there so it can be overridden :)
Renate