I have a custom Component (cut down)
TMyComponent = class(TComponent)
public
procedure ClientConnected;
published
property ClientSocket: TClientSocket Read ...etc
Right now i have in the OnConnect Event of the ClientSocket Call ClientConnected e.g.
procedure TForm1.ElvinClient1Connect(Sender: TObject; Socket: TCustomWinSocket);
begin
MyComponent1.ClientConnected;
end;
Is there a way to do this with in the TMyComponent Class with out the need of the external event?
Edit:
Forgot to say that the ClientSocket is not create by the component, its assigned at runtime.
i have also tried having a private Proc
procedure TMyComponent.OnClientConnected(sender: TObject);
begin
ClientConnected;
if Assigned(oldOnClientConnected) then
oldOnClientConnected(sender);
end;
and the a setter for the ClientSocket
procedure TMyComponent.SetClientSocket(const Value: TClientSocket);
begin
fClientSocket := Value;
oldOnClientConnected:= fClientSocket.OnElvinConnected;
fClientSocket.oldOnClientConnected:= OnClientConnected;
end;
But i get the feeling that it will come back to haunt me...