Ho parzialmente risolto il problema modificando la seguente funzione:
function TCustomStringGrid.DoCompareCells(Acol, ARow, Bcol, BRow: Integer): Integer;
begin
if Assigned(OnCompareCells) then
Result:=inherited DoCompareCells(Acol, ARow, Bcol, BRow)
else begin
// Result:=UTF8CompareLatinTextFast(Cells[ACol,ARow], Cells[BCol,BRow]);
//-------------------------- Modificato x ordinare stringgrid
try
result := CompareValue(StrTofloat(Cells[ACol,ARow]), StrTofloat(Cells[BCol,BRow]));
Except
result := AnsiCompareText(Cells[ACol,ARow], Cells[BCol,BRow]);
end;
//-------------------------------------------
if SortOrder=soDescending then
result:=-result;
end;
end;
in PrepareCanvas :
ts.Alignment := taCenter;
Scusate non avero ricopiato il file Grids.pas. Funziona perfettamente con
la seguente modifica alla funzione TCustomStringGrid.DoCompareCells:
function TCustomStringGrid.DoCompareCells(Acol, ARow, Bcol, BRow: Integer): Integer;
begin
if Assigned(OnCompareCells) then
Result:=inherited DoCompareCells(Acol, ARow, Bcol, BRow)
else begin
// Result:=UTF8CompareLatinTextFast(Cells[ACol,ARow], Cells[BCol,BRow]);
//-------------------------- Modificato x ordinare stringgrid
try
result := CompareValue(StrTofloat(Cells[ACol,ARow]), StrTofloat(Cells[BCol,BRow]));
Except
result := AnsiCompareText(Cells[ACol,ARow], Cells[BCol,BRow]);
end;
//-------------------------------------------
if SortOrder=soDescending then
result:=-result;
end;
end;