TTMSFNCGrid.FloatFormat

Am I using the TTMSFNCGrid.FloatFormat wrong..?

GridICOverview.FloatFormat:= '###.##';
GridICOverview.Floats[3, R]:= 1000;

Where R is the row number. The column 114200 should display 1000.00 but it displays ###.##. Why? I do not understand.

Greetings,
Fons

image

When I delete the line "GridICOverview.FloatFormat:= '###.##';" from my code, than result is as follows. But, than I do not have the formatting I want to have.

image

The floatformat follows the format parameters: Delphi Basics : format command

Sorry, to many different format options and to many programming languages... sometimes one gets confused.

Thanks,
Fons

No worries thanks for your feedback!

Hi Pieter,

Now that is fixed, I have the following issue... The amounts in column 114200 are done using Grid.Floats but the sorting is wrong. Do I need to set some options to make it sort correctly?

Thanks,
Fons

Hi,

Sorting detection happens automatically, we couldn't see an issue here when sorting. If for some reason it does not detect the sorting properly, you can customize the sort using OnSortFormat event and setting the sortformat to ssNumeric. If that does not work, you can set the sort format to ssCustom, and use the OnCustomCompare event

Hi Pieter,

With the following code:

GridICOverview.FloatFormat:= '%n';

if Random(10) >= 6 then
D:= Random(100000) x 1.1
else
D:= random(100000) x -1.2;
GridICOverview.Floats[3, R]:= D;

where D is a double type variable the result is as follows when sorting.

And replace the x with an * (had to use an x because with an * something displayed wrong)

The sorting does not take into account whether it is a positive or negative number.

Using Delphi 11 with Update 1 and most recent TMS FNC release.

Can you conform the same kind of error..?

Greetings,
Fons

image

Again, the values recognization process might take the numbers for strings. Please set:

procedure TForm1.TMSFNCGrid1SortFormat(Sender: TObject; Col: Integer;
  var SortFormat: TTMSFNCGridSortFormat; var APrefix, ASuffix: string);
begin
  if Col = 3 then
    SortFormat := ssNumeric;
end;

Using the OnSortFormat and OnCustomCompare I got it working now :smiley:

Thanks,
Fons

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.