Para las clases, los datalinks dispara métodos en las clases cuando estos reciben alguna notificación.
Esto es un pedazo muy recortado del código, así que no pretendan que funcione:
La Interface:
Código:
IDBLookupControl = interface
...
procedure UpdateDataFields;
procedure UpdateListFields;
procedure ListLinkDataChanged;
...
end;
Un DataLink:
Código:
TListSourceLookupLink = class(TDataLink)
private
ILookup: IDBLookupControl;
protected
procedure ActiveChanged; override;
procedure DataSetChanged; override;
procedure LayoutChanged; override;
...
public
constructor Create(ALookupInterface: IDBLookupControl);
...
end;
implementation
{ TListSourceLookupLink }
procedure TListSourceLookupLink.ActiveChanged;
begin
if Assigned(ILookup) then
ILookup.UpdateListFields;
end;
constructor TListSourceLookupLink.Create(ALookupControl: TWinControl; ALookupInterface: IDBLookupControl);
begin
inherited Create;
...
ILookup := ALookupInterface;
end;
procedure TListSourceLookupLink.DataSetChanged;
begin
if Assigned(ILookup) then
ILookup.ListLinkDataChanged;
end;
procedure TListSourceLookupLink.LayoutChanged;
begin
if Assigned(ILookup) then
ILookup.UpdateListFields;
end;
Uno de los Componentes:
Código:
TCustomDBLookupControl = class(TCustomIncSearchEdit, IDBLookupControl)
protected
...
procedure UpdateDataFields; virtual;
procedure UpdateListFields; virtual;
procedure ListLinkDataChanged; virtual; abstract;
...
end;
¿Fui claro?... sino, ya saben!