Changing colour of label in DBCtrlGrid

From: Philip Grace (phil_at_niche-cs.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 14:35:23 +0100

function TFalconDBText.GetFieldText: string;
var
  fField : real;
begin
  if FDataLink.Field <> nil then begin
    fField := FDataLink.Field.AsFloat;
    if Commas then
      result := format('%.*n', [DecimalPlaces, fField])
    else
      result := format('%.*f', [DecimalPlaces, fField]);
    if fField = 0 then Font.Color := ZeroColor;
    if fField > 0 then Font.Color := PosColor;
    if fField < 0 then begin
      Font.Color := NegColor;
      if bBracketNegative then
        if Commas then
          result := format('(%.*n)', [DecimalPlaces, fField * -1])
        else
          result := format('(%.*f)', [DecimalPlaces, fField * -1]);
    end;
// Result := FDataLink.Field.DisplayText;
  end
  else
    if csDesigning in ComponentState then Result := Name else Result := '';
end;