Declaration
type TIEImageAddEvent = procedure(Sender : TObject;
idx : integer;
const sFilename : string;
IsFolder : boolean;
IsHiddenFile : boolean;
FileSizeBytes : Int64;
CreateDate : TDateTime;
EditDate : TDateTime;
var Allow : 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 |
| IsFolder | True for folders, false for files |
| IsHiddenFile | True for files marked hidden in file properties |
| FileSizeBytes | Size of the file in bytes |
| CreateDate | Date the file was created |
| EditDate | Date the file was last modified |
| Allow | Defaults to false. Set to true to skip the addition of this file |
procedure TForm1.ImageEnMView1ImageAdd(Sender : TObject; idx : integer; const sFilename : string; IsFolder : boolean; IsHiddenFile : boolean; FileSizeBytes : Int64; CreateDate : TDateTime; EditDate : TDateTime; var Allow : Boolean);
const
ONE_MB = 1024 * 1024;
begin
// Don't add files larger than one MB
if FileSizeBytes > ONE_MB then
Allow := False;
end;
procedure TForm1.ImageEnMView1ImageAdd(Sender : TObject; idx : integer; const sFilename : string;
IsFolder : boolean; IsHiddenFile : boolean; FileSizeBytes : Int64;
CreateDate : TDateTime; EditDate : TDateTime; var Allow : Boolean);
const
ONE_YEAR = 365;
begin
// Don't add files more than a year old
if EditDate < Now - ONE_YEAR then
Allow := False;
end;