ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
JamFilePreview.TJamFilePreview.OnLoadPreview

Occurs before the preview handler is loaded for the given file

Syntax
Pascal
property OnLoadPreview: TJamFilePreviewLoadPreviewEvent;

Use this event to control the PreviewHandler that is chosen to show the given file and to determine if a thumbnail of the file is acceptable. See TJamFilePreviewLoadPreviewEventArgs for details

The following lines of code will force the loading of thumbnail for pdf files instead of using a preview handler.

if LowerCase(ExtractFileExt(eventArgs.Path)) = '.pdf' then
  eventArgs.LoadThumbnail := true;

This example shows how to use the HTML preview handler for files with the extensions CSM:

if LowerCase(ExtractFileExt(eventArgs.Path)) = '.csm' then
  eventArgs.PreviewHandlerGuid := StringToGUID('{F8B8412B-DEA3-4130-B36C-5E8BE73106AC}');

The following example checks the PreviewHandler that will be used, and forces the loading and unloading of such previews to the GUI thread. Doing so can be a workaround for rare cases where an external previewhandler has problems when being executed to a non-gui thread.

if (eventArgs.PreviewHandlerGuid = TShellPreviewHandlerGuids.Excel) then
  eventArgs.ForceGUIThread := true;