Discussion:
sub-properties events
(too old to reply)
PlutoPlanet
2006-12-29 12:25:18 UTC
Permalink
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
Erich Günthner
2007-01-18 14:45:56 UTC
Permalink
Hallo,
have you solved your problem, or ist it still exists?
Maybe i can help you.

erich
Post by PlutoPlanet
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
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
Loading...