Ver Mensaje Individual
  #3  
Antiguo 07-07-2021
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.288
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Entiendo que el problema es que, aunque FDTRESULTADOS y FDQBUSQUEDA tienen ambos el campo int_res, no puedes hacer referencia directamente a ellos en el evento.

En ese caso, puedes acceder al Dataset (sea FDTRESULTADOS o FDQBUSQUEDA) utilizando el Sender en tiempo de ejecución.
Prueba con un código como este:

Código Delphi [-]
var
  ds:TDataset;
begin
  ds := nil;
  // el sender debería ser un TDBGrid (pero lo comprobamos...)
  if (Sender is TDBGrid) then
    ds := TDBGrid(Sender).DataSource.DataSet;
  // Aquí, ds será FDTRESULTADOS o FDQBUSQUEDA

  // Si no está asignado, salimos...
  if not Assigned(ds) then
    Exit;
  // comprobamos el campo...
  if (ds.FieldByName('int_res').AsString <> '')  then begin
    DBGrid1.Canvas.Brush.Color := clMoneyGreen;
    DBGrid1.Canvas.Font.Color := clWhite;
    DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
  end;
end;

Te lo pongo de memoria, si te falla algo dímelo...
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita