From 8b65a83953b0c4ea9b64b1c67ca5a636aba31b70 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Mon, 9 Mar 2009 22:38:38 +0000 Subject: [PATCH] Fix previous commit: Same float format in Query grid as in Data grid --- components/heidisql/include/const.inc | 3 +++ source/main.pas | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/heidisql/include/const.inc b/components/heidisql/include/const.inc index c753c741..d2a4afdd 100644 --- a/components/heidisql/include/const.inc +++ b/components/heidisql/include/const.inc @@ -299,6 +299,9 @@ const // Data grid: How many rows to display in total GRIDMAXTOTALROWS = 100000; + // Used to format floats in datagrids via FormatFloat() + GRIDFLOATFORMAT = '0.0##############################'; + // How many milliseconds to wait before showing a 'waiting for database' sign. QUERYWAITTIME: Integer = 2500; diff --git a/source/main.pas b/source/main.pas index e14e3a4c..5ffc6503 100644 --- a/source/main.pas +++ b/source/main.pas @@ -4785,6 +4785,8 @@ begin for j:=0 to ds.FieldCount-1 do begin if FQueryGridResult.Columns[j].IsBinary then FQueryGridResult.Rows[i].Cells[j].Text := '0x' + BinToWideHex(ds.Fields[j].AsString) + else if FQueryGridResult.Columns[j].IsFloat then + FQueryGridResult.Rows[i].Cells[j].Text := FormatFloat(GRIDFLOATFORMAT, MakeFloat(ds.Fields[j].AsString)) else FQueryGridResult.Rows[i].Cells[j].Text := ds.Fields[j].AsWideString; FQueryGridResult.Rows[i].Cells[j].IsNull := ds.Fields[j].IsNull; @@ -7633,7 +7635,7 @@ begin if res.Columns[j].IsBinary then res.Rows[i].Cells[j].Text := '0x' + BinToWideHex(ds.Fields[j].AsString) else if res.Columns[j].IsFloat then - res.Rows[i].Cells[j].Text := FormatFloat('0.0##############################', MakeFloat(ds.Fields[j].AsString)) + res.Rows[i].Cells[j].Text := FormatFloat(GRIDFLOATFORMAT, MakeFloat(ds.Fields[j].AsString)) else res.Rows[i].Cells[j].Text := ds.Fields[j].AsWideString; res.Rows[i].Cells[j].IsNull := ds.Fields[j].IsNull; @@ -7696,7 +7698,7 @@ begin if res.Columns[j].IsBinary then res.Rows[i].Cells[j].Text := '0x' + BinToWideHex(ds.Fields[j].AsString) else if res.Columns[j].IsFloat then - res.Rows[i].Cells[j].Text := FormatFloat('0.0##############################', MakeFloat(ds.Fields[j].AsString)) + res.Rows[i].Cells[j].Text := FormatFloat(GRIDFLOATFORMAT, MakeFloat(ds.Fields[j].AsString)) else res.Rows[i].Cells[j].Text := ds.Fields[j].AsWideString; res.Rows[i].Cells[j].IsNull := ds.Fields[j].IsNull;