Ver Mensaje Individual
  #5  
Antiguo 07-08-2007
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Reputación: 21
gluglu Va por buen camino
No tiene nada que ver que sea tipo String o cualquier otro tipo.

De nuevo insisto en que tu código tiene que ser de la siguiente manera para que te funciona correctamente :
Código Delphi [-]
TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if table1estatus := 'finalizado' then
  begin
    DBGrid1.canvas.brush.color :=clBlue;
  end else
  begin
    DBGrid1.canvas.brush.color :=clRed;
  end;
  DBGrid1.DefaultDrawColumnCell(rect,DataCol,Column,State);
End;
Al menos, en el código que expones, sobra un End; y después no sé si tu mismo te aclaras donde debe de ir el begin y el end de cada bloque.

He modificado tu código dejando el begin y end para cada bloque. Pero de hecho dichos begin y end sobran en el caso particular propuesto, por lo que podría quedar así :
Código Delphi [-]
TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if table1estatus := 'finalizado' then
    DBGrid1.canvas.brush.color :=clBlue
  else
    DBGrid1.canvas.brush.color :=clRed;
  DBGrid1.DefaultDrawColumnCell(rect,DataCol,Column,State);
End;
tal y como expuse anteriormente.

Además en la línea del DBGrid1.DefaultDrawColumnCell te falta terminarla con ';'.

La otra forma que pones, también le sobra un end;
Código Delphi [-]
TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if table1estatus := 'finalizado' then
  begin
    DBGrid1.canvas.brush.color :=clBlue;
  end else
    if table1estatus := 'pendiente' then
    begin
      DBGrid1.canvas.brush.color :=clRed;
      DBGrid1.DefaultDrawColumnCell(rect,DataCol,Column,State);
    End;
End;
y tampoco está terminada con ';' la fila del DefaultDrawColumnCell.

Fíjate bien en los bloques Begin End. Ahí es donde tienes el error. No en si es de tipo String u otro tipo.
__________________
Piensa siempre en positivo !
Responder Con Cita