ImageEn, unit iexFolderMView

TImageEnFolderMView.OnCustomSortCompare

TImageEnFolderMView.OnCustomSortCompare


Declaration

property OnCustomSortCompare: TIEImageEnMViewSortCompareEx;


Description

Occurs whenever the content needs to be sorted if SortOrder is set to iesbCustom.


Example

// custom sort function (by DPI)
function TMyForm.IEFolderMView1CustomSortCompare(i1, i2: Integer): Integer;
var
  dpi1, dpi2: Integer;
begin
  dpi1 := IEFolderMView1.Params[i1].DPI;
  dpi2 := IEFolderMView1.Params[i2].DPI;

  if dpi1 < dpi2 then
    result := -1
  else
  if dpi1 > dpi2 then
    result := 1
  else
    result := 0;

  // Or more concise: Result := dpi1 - dpi2;
end;

// Sort By DPI
procedure TForm1.btnCustomSortClick(Sender: TObject);
begin
  IEFolderMView1.SortOrder := iesbCustom;
end;