 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
PlutoPlanet Guest
|
Posted: Fri Dec 29, 2006 6:25 pm Post subject: sub-properties events |
|
|
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 |
|
| Back to top |
|
 |
Erich Günthner Guest
|
Posted: Thu Jan 18, 2007 8:45 pm Post subject: Re: sub-properties events |
|
|
Hallo,
have you solved your problem, or ist it still exists?
Maybe i can help you.
erich
PlutoPlanet schrieb:
| Quote: | 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
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|