Declaration
procedure Sort(Compare: TIEImageEnMViewSortCompare); overload;
procedure Sort(Compare: TIEImageEnMViewSortCompareEx); overload;
procedure Sort(OrderBy: TIEImageEnMViewSortBy; Ascending: boolean = true; CaseSensitive: boolean = true); overload;
procedure Sort(OrderBy: TIEImageEnMViewSortBy; SortOptions: TIEMSortOptions); overload;
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 considering any digits within the name
// e.g. img1.jpg, img10.jpg, img11.jpg, img2.jpg, img20.jpg will be sorted as img1.jpg, img2.jpg, img10.jpg, img11.jpg, img20.jpg
ImageEnMView1.Sort( iesbFilename, [iesNaturalSorting] );
Example 3
// sort by filename even if files come from different folders
ImageEnMView1.Sort( iesbFilenameWithoutPath );
Example 4
// 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;