ImageEn, unit iemview

TImageEnMView.OnGetLoadFilename

TImageEnMView.OnGetLoadFilename


Declaration

property OnGetLoadFilename: TIEGetLoadFilenameEvent;


Description

Occurs whenever an image is loaded from file, allowing an alternative filename to be specified.

Index is the index of the image being displayed (i.e. 0 for first image in the grid, 1 for second, etc.)
Filename is the image to load to fill the displayed thumbnail. Specify as '' to force the default icon (no thumbnail loading).

Note: To supply a bitmap as an alternative thumbnail source, use the OnImageIDRequestEx event


Examples

procedure TMyForm.ImageEnMViewOnGetLoadFilename(Sender: TObject; Index: integer; var Filename: string);
var
  cacheFilename: string;
begin
  // Use our own cache as a source for thumbnails
  cacheFilename := LookupCacheTable( Filename );
  if cacheFilename = '' then
  begin
    cacheFilename := GenerateCacheFile( Filename );
    AddToCacheTable( Filename, cacheFilename );
  end;

  Filename := cacheFilename;
end;

// Specify an icon to use for PDF files on removable devices (to improve performance)
procedure TForm1.IEFolderMViewGetLoadFilename(Sender: TObject; Index: Integer;
    var Filename: string);
begin
  if FileIsWPDItem( Filename ) and
     ( Uppercase( ExtractFileExt( Filename )) = '.PDF' ) then
    Filename := IncludeTrailingPathDelimiter( ExtractFilePath( Application.ExeName )) + 'MyPDFIcon.ico';
end;

// Use default icon for all files on removable devices (to improve performance)
procedure TForm1.IEFolderMViewGetLoadFilename(Sender: TObject; Index: Integer;
    var Filename: string);
begin
  if FileIsWPDItem( Filename ) then
    Filename := '';
end;


See Also

OnImageIDRequest
OnImageIDRequestEx