ImageEn, unit iexBitmaps

GetOpenSaveDialogFilter


Declaration

function GetOpenSaveDialogFilter(IsSaveDialog: Boolean;
                                 ShowFormats : TIEShowFormats = iesfImagesOnly;
                                 LimitToType : TIOFileType = -1;
                                 ExtendedFilters: string = '';
                                 TruncExtCount: Integer = 0) : string;


Description

Returns a filter that can be used for open and save dialogs.
Result will be something like: 'JPEG Files|*.jpeg;*.jpg|GIF Files|*.gif|All Images|*.jpeg;*.jpg;*.gif...|All Files|*.*'

Parameter Description
IsSaveDialog If False, "All Images" and "All Files" items are included
ShowFormats Limits the file types listed in the filter, as well determining which formats are included in the "All Image Files" filter
LimitToType Limit the filter to a specific image format
ExtendedFilters Specify additional file formats to include, e.g. 'Fun Bitmap|*.fun;*.fan;'
TruncExtCount Should always be 0. When > 0 "All Files" truncates the extension list to n extensions per format


Examples

// Prompt user to open an image
dlg := TOpenDialog.Create(Self);
dlg.Filter := GetOpenSaveDialogFilter( False, ShowFormats, LimitToFileType, ExtendedFilters );
if dlg.Execute then ...
FreeAndNil(dlg);

// Prompt user to save an image
dlg := TSaveDialog.Create(Self);
dlg.Filter := GetOpenSaveDialogFilter( True, ShowFormats, LimitToFileType, ExtendedFilters );
if dlg.Execute then ...
FreeAndNil(dlg);

// Prompt user to open a multi-frame image
dlg := TOpenDialog.Create(Self);
dlg.Filter := GetOpenSaveDialogFilter( False, iesfMultiImagesOnly );
dlg.FilterIndex := FilterIndex;
if dlg.Execute then ...
FreeAndNil(dlg);

// Prompt user to save a multi-frame image
dlg := TSaveDialog.Create(Self);
dlg.Filter := GetOpenSaveDialogFilter( True, iesfMultiImagesOnly, -1, '' );
if dlg.Execute then ...
FreeAndNil(dlg);


Compatibility Information

Prior to v9.2.5 there was a MultiFrameSaveOnly parameter. Code that was:
s := GetOpenSaveDialogFilter( True, iesfImagesOnly, -1, '', True );

Should be changed to:
s := GetOpenSaveDialogFilter( True, iesfMultiImagesOnly, -1, '' );


See Also

 GetAllSupportedFileExtensions
 GetFileExtensionsOfType