Ver Mensaje Individual
  #4  
Antiguo 20-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
No te preocupes, si me aburriera no estaría aca leyendo...

Olvidate por completo de la Grilla,este código no vá:
Código Delphi [-]
{
Procedure GrillaDrawColumnCell(Sender: TObject;const Rect: TRect; DataCol: Integer; Column:TColumn; State: TGridDrawState);
begin
if (Grilla.DataSource.DataSet['Espesor'] > 0 ) then begin
Grilla.DataSource.DataSet['Espesor'].OnGetText := qrCotDetalleEspesorGetText ;
end;
}

En el Form donde tengas la Tabla o Query, hacé esto:
Código Delphi [-]
procedure TForm.Create(Sender: TObject);
begin
   Query1.FieldByName('Espesor').OnGetText:= FieldGetText;
   // o si es Table:
   Table1.FieldByName('Espesor').OnGetText:= FieldGetText;
end;

Ahora ya tenemos asignado el procedimiento FieldGetText al evento OnGetText del campo 'Espesor', así que escribimos el procedimiento:
Código Delphi [-]
procedure TForm.FieldGetText(Sender: TField; var Text: String;DisplayText: Boolean);
begin
  if TField(sender).Value > 0 Then
       Text := FormatFloat('0.0000',TField(Sender).Value) ;
end;

La asignación al evento OnGetText del campo 'Espesor' se produce cuando se crea el Form y ya está, no hay que asignarlo a cada dibujo de la Grilla.

Ante cualquier duda, escribí nuevamente.


Saludos.
Responder Con Cita