PlutoPlanet
2006-12-29 12:25:18 UTC
Hello World
I wrote a component (MyComponent) that contains a TSQLConnection as
subproperty.
property MyConnection: TSQLConnection read FConnection write
SetMyConnection;
To be informed when a connection is being established I did the
following:
procedure TMyComponent.SetMyConnection( Value: TSQLConnection )
begin
if Value <> nil then
begin
Self.MyConnection.AfterConnect := Self.HandleConnect;
end;
end;
procedure TMyComponent.HandleConnect( Sender: TObject )
begin
// do some stuff
end;
This works pretty good as long as there is a TSQLConnection connected
with only one TMyComponent.
As soon as I have 2 or more TMyComponents connected with the same
TSQLConnection it doesn't work anymore because the TSQLConnection's
AfterConnect only points to the last one beeing selected within
TMyComponent.
What is the right way getting notified about events of sub-properties?
Thanks,
Herwig
I wrote a component (MyComponent) that contains a TSQLConnection as
subproperty.
property MyConnection: TSQLConnection read FConnection write
SetMyConnection;
To be informed when a connection is being established I did the
following:
procedure TMyComponent.SetMyConnection( Value: TSQLConnection )
begin
if Value <> nil then
begin
Self.MyConnection.AfterConnect := Self.HandleConnect;
end;
end;
procedure TMyComponent.HandleConnect( Sender: TObject )
begin
// do some stuff
end;
This works pretty good as long as there is a TSQLConnection connected
with only one TMyComponent.
As soon as I have 2 or more TMyComponents connected with the same
TSQLConnection it doesn't work anymore because the TSQLConnection's
AfterConnect only points to the last one beeing selected within
TMyComponent.
What is the right way getting notified about events of sub-properties?
Thanks,
Herwig