Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#14

AW: (nonVcl) ListView Sortieren ein durcheinander

  Alt 25. Feb 2017, 13:18
irgend jemand ne Ahnung wie ich das hier auf Luckies Compare Funktion umlegen kann?

Delphi-Quellcode:
//Float-Werte
     2: begin
       Compare := 0;
       if StrToFloat(TextToSort1) > StrToFloat(TextToSort2) then
         Compare := Trunc(StrToFloat(TextToSort1)-StrToFloat(TextToSort2))+1;
       if StrToFloat(TextToSort1) < StrToFloat(TextToSort2) then
         Compare := Trunc(StrToFloat(TextToSort1)-StrToFloat(TextToSort2))-1;
     end; //2
//DateTime-Werte
     3: begin
       Compare := 0;
       if StrToDateTime(TextToSort1) > StrToDateTime(TextToSort2) then
         Compare := Trunc(StrToDateTime(TextToSort1)-StrToDateTime(TextToSort2))+1;
       if StrToDateTime(TextToSort1) < StrToDateTime(TextToSort2) then
         Compare := Trunc(StrToDateTime(TextToSort1)-StrToDateTime(TextToSort2))-1;
     end; //3
Ich könnte mir dann diesen type erweitern.
TSortType = (sortInt = 1, sortString = 2);
TSortType = (sortInt = 1, sortString = 2, sortFloat = 3, sortDateTime = 4);
gruss
  Mit Zitat antworten Zitat