Advertisement
maskofa

Descending StringGrid (yang sudah urut secara Ascending)

Nov 27th, 2021
1,369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.71 KB | None | 0 0
  1. procedure DescendingSort(GenStrGrid: TStringGrid);
  2. var
  3.   iii: Integer;
  4.   jjj: Integer;
  5.   rrr: Integer;
  6.   xxx: Integer;
  7.   yyy: Integer;
  8. begin
  9.   yyy := GenStrGrid.FixedRows;
  10.   rrr := GenStrGrid.RowCount;
  11.   xxx := rrr - yyy;
  12.   GenStrGrid.RowCount := rrr + xxx;
  13.  
  14.   //copy ke baris bawah (baris bantuan) dengan urutan terbalik;
  15.   jjj :=  GenStrGrid.RowCount - 1;
  16.   for iii := yyy to rrr - 1 do
  17.   begin
  18.     GenStrGrid.Rows[jjj] := GenStrGrid.Rows[iii];
  19.     dec(jjj);
  20.   end;
  21.  
  22.   //kembalikan ke atas yg sudah kebalik;
  23.   jjj :=  rrr;
  24.   for iii := yyy to rrr - 1 do
  25.   begin
  26.     GenStrGrid.Rows[iii] := GenStrGrid.Rows[jjj];
  27.     inc(jjj);
  28.   end;
  29.  
  30.   //hapus baris bantuan;
  31.   GenStrGrid.RowCount := rrr;
  32. end;
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement