String Grid SORT functionality lazarus / 31-LCL ---------------------------------------------------------------------- Ed78z · 2021-08-31 02:41 Hello, I am using a StringGrid component in my app, I just noticed when I am clicking on header column it sorts based on simple comparison (maybe just a ">" operand). My question is: Is there any "logical sort" functionality in Lazarus at all? Is it possible to replace current sort algorithm in the StringGrid component with a logical sort? Thanks ---------------------------------------------------------------------- winni · 2021-08-31 07:04 Hallo! You can connect with the event onCompareCells of the stringGrid and then  for an integer sort: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.StringGrid1CompareCells(Sender: TObject; ACol, ARow, BCol, BRow: Integer; var Result: integer); beginwith StringGrid1 do   begin    result := StrToInt64Def(Cells[ACol,ARow],0)-StrToInt64Def(Cells[BCol,BRow],0);   if SortOrder = soDescending then result := -result;end;// withend; For unsigned values you use Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i result := StrToQWordDef(Cells[ACol,ARow],0)-StrToQwordDef(Cells[BCol,BRow],0);  And for float values: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i result := r ound(StrToFloatDef(Cells[ACol,ARow],0)- StrToFloatDef(Cells[BCol,BRow],0));       Winni