ImageEn, unit iemview

TIEImageAddEvent

TIEImageAddEvent


Declaration


type TIEImageAddEvent = procedure(Sender : TObject;
                                  idx : integer;
                                  const sFilename : string;
                                  bFolder : boolean;
                                  bHiddenFile : boolean;
                                  iFileSizeBytes : Int64;
                                  CreateDate : TDateTime;
                                  EditDate : TDateTime;
                                  var bAllow : Boolean) of object;


Description


Occurs whenever an image is added to a TImageEnFolderMView or when using TImageEnMView.FillFromDirectory.

Set bAllow to skip the addition of certain files.

Value Description
Sender The TImageEnFolderMView or TImageEnMView
idx The new position for this file
sFilename The full path of the file or folder
bFolder True for folders, false for files
bHiddenFile True for files marked hidden in file properties
iFileSizeBytes Size of the file in bytes
CreateDate Date the file was created
EditDate Date the file was last modified
bAllow Defaults to false. Set to true to skip the addition of this file



Examples


procedure TfMain.ImageEnMView1ImageAdd(Sender : TObject; idx : integer; const sFilename : string; bFolder : boolean; bHiddenFile : boolean; iFileSizeBytes : Int64; CreateDate : TDateTime; EditDate : TDateTime; var bAllow : Boolean);
const
  ONE_MB = 1024 * 1024;
begin
  // Don't add files larger than one MB
  if iFileSizeBytes > ONE_MB then
    bAllow := False;
end;

procedure TfMain.ImageEnMView1ImageAdd(Sender : TObject; idx : integer; const sFilename : string;
                                       bFolder : boolean; bHiddenFile : boolean; iFileSizeBytes : Int64;
                                       CreateDate : TDateTime; EditDate : TDateTime; var bAllow : Boolean);
const
  ONE_YEAR = 365;
begin
  // Don't add files more than a year old
  if EditDate < Now - ONE_YEAR then
    bAllow := False;
end;