ImageEn, unit iemview

TImageEnMView.Sort

TImageEnMView.Sort


Declaration


procedure Sort(Compare: TIEImageEnMViewSortCompare);
procedure Sort(Compare: TIEImageEnMViewSortCompareEx);
procedure Sort(OrderBy: TIEImageEnMViewSortBy; Ascending: boolean = true; CaseSensitive: boolean = true);


Description


Sorts all images in the TImageEnMView by property (filename, dimensions, etc) or using a custom comparison function.


Example 1


// sort by filename
ImageEnMView1.Sort( iesbFilename );


Example 2


// sort by filename even if files come from different folders
ImageEnMView1.Sort( iesbFilenameWithoutPath );


Example 3


// custom sort function (by DPI)
function XCompareDPI(i1, i2: Integer): Integer;
var
  s1, s2: Integer;
begin
  s1 := Form1.ImageEnMView1.Params[i1].DPI;
  s2 := Form1.ImageEnMView1.Params[i2].DPI;

  if s1 < s2 then
    result := -1
  else
  if s1 > s2 then
    result := 1
  else
    result := 0;
end;

// Sort By DPI
procedure TForm1.Button1Click(Sender: TObject);
begin
  ImageEnMView1.Sort( XCompareDPI );
end;