Creo que la solución sería:
- Poner AutoCalcFields = False;
- Crear un campo calculado que contenga el color con el que debe pintarse
- Cuando se abra la tabla, se deberá hacer un FetchAll y dejar que el OnCalcFields calcule el varlor del color.
Código Delphi
[-]var
ValorAnterior: string;
Sombra : boolean;
procedure TDataModule.TablaBeforeOpen(DataSet: TDataSet);
begin
Sombra := False;
ValorAnterior := '';
end;
procedure TDataModule.TablaOnCalcFields(DataSet: TDataSet);
begin
if (ValorAnterior<>TablaNRO_ASIENTO.AsString) then
Sombra := not Sombra;
TablaCAMPO_CALCULADO_SOMBRA.AsBoolean := Sombra;
end;
Nota: Según la ayuda de Delphi 6:
Cita:
When AutoCalcFields is True (the default), Lookup fields are recalculated and OnCalcFields is triggered when:
The dataset is opened.
The dataset is put into dsEdit state.
Focus moves from one visual control to another, or from one column to another in a data-aware grid and modifications have been made to the record.
When AutoCalcFields is False, Lookup fields are recalculated and the OnCalcFields event occurs only when
The dataset is opened.
The dataset is put into dsEdit state.
A record is retrieved from a database.
|