Bueno, hay que concentrarse un poco para entender, y nunca está de mas poner algo de código, pues nos ayuda a analizar si el problema es el que describes o es algo que no has visto...
Por otro lado considero que si tienes un objeto TCliente dentro de TFactura, es redundante tener un IdCliente en tu clase factura... pero bueno, eso depende lo que estes haciendo...
El evento que te indica si un cliente cambió no debe originarse desde tu factura, sino desde el mismo TCliente
Código Delphi
[-]Type
TOnCambioCliente = procedure(IdCliente: Integer) of Object;
TCliente =Class
Private
FOnCambioCliente : TOnCambioCliente;
public
Property OnCambioCliente: TOnCambioCliente read FOnCambioCliente write FOnCambioCliente;
Procedure CargarCliente;
end;
Procedure TCliente.CargarCliente;
Begin
if assigned(FOnCambioCliente) then
FOnCambioCliente(Self.IdCliente);
end;
y en tu clase factura lo debes capturar...
Código Delphi
[-]TFactura= Class
Private
FIdCliente: Integer;
FObjetoCliente: TCliente;
Public
Constructor Create;
Property idCliente: Integer read FIdCliente;
Procedure MyOnCambioCliente(IdCliente: Integer);
end;
Constructor TFactura.Create;
Begin
inherited;
FObjetoCliente:= TCliente.Create;
FObjetoCliente.OnCambioCliente:= MyOnCambioCliente;
end;
Procedure TFactura.MyOnCambioCliente(IdCliente: Integer);
Begin
FIdCliente := IdCliente;
end;
Ahora, como te decia, no me parece natural que tengas un IDCliente en tu TFactura si ya tienes un TCliente asociado... asi que podrías dar acceso a tu cliente desde la factura:
Código Delphi
[-]LaFactura.Cliente.IdCliente ...
O podrias redefinir la propiedad IdCliente de la factura asi:
Código Delphi
[-]TFactura= Class
Private
FObjetoCliente: TCliente;
Function GetIdCliente: Integer ;
Procedure setIdCliente(Value: Integer);
Public
Property idCliente: Integer read GetIdCliente write setIdCliente;
end;
Function TFactura.GetIdCliente: Integer ;
Begin
Result:= FObjetoCliente.IdCliente;
end;
Procedure TFactura.setIdCliente(Value: Integer);
Begin
FObjetoCliente.CargarCliente(Value);
end;
espero que te haya servido...