ImageEn, unit iemio

TImageEnMIO.ExecuteSaveDialog

TImageEnMIO.ExecuteSaveDialog


Declaration

function ExecuteSaveDialog(const InitialDir : WideString = ''; const InitialFileName : WideString = ''; AlwaysAnimate : boolean = False;
                           FilterIndex: integer = 0; const ExtendedFilters : WideString = ''; const Title : WideString = '';
                           const Filter : WideString = ''; DefaultFilter : TIOFileType = -1; LimitToFileType : TIOFileType = -1;
                           OverwritePrompt: Boolean = False; ShowFormats: TIEShowFormats = iesfMultiImagesOnly) : String; overload;
function ExecuteSaveDialog(const Title : WideString; DefaultFilter : TIOFileType; LimitToFileType : TIOFileType = -1;
                           AlwaysAnimate : boolean = False; OverwritePrompt: Boolean = False; ShowFormats: TIEShowFormats = iesfMultiImagesOnly) : String; overload;


Description

Prompts the user with a save dialog to specify a save filename. It encapsulates the TSaveImageEnDialog component.



Parameter Description
InitialDir Folder displayed on opening (leave as '' for no default)
InitialFileName Default file name with extension (leave as '' for no default)
AlwaysAnimate Enable to animate GIF and AVI (without user needing to click the play button). Default is False
FilterIndex The index of the default selected item in the filter (one-based). Default is 0.
Note: While this can change, the first five items are generally:
1: Common graphics formats
2: All Graphics formats
3: JPEG
4: TIFF
5: GIF

However, it is generally safer to use the DefaultFilter parameter instead
ExtendedFilters Any additional file formats to add to the filter (example: 'Fun Bitmap|*.fun;*.fan')
Title The dialog title. If unspecified the Windows default title is used
Filter Override the default filter with a custom one (e.g. 'JPEG Image (JPG)|*.jpg|GIF Image (GIF)|*.gif')
DefaultFilter Specify the file type that is displayed by default. This setting overrides FilterIndex, but is ignored if you have specified InitialFileName. Default is -1
LimitToFileType Limits the filter to a specified ImageEn file type. Default is -1
OverwritePrompt Adds ofOverwritePrompt to dialog options, which generates a warning message if the user tries to select a filename that is already in use (asking whether to overwrite the existing file)
ShowFormats Limit format to images, multi-frame images and/or videos (Has no effect if Filter has been specified)

Returns a null string ('') if the user clicks Cancel.

Note: An ImageEn save dialog will be used. To use a standard Windows Save dialog, enable UseWindowsOpenSaveDialogs


Examples

// Prompt user to save a file in an ImageEnMView
sFilename := ImageEnMView1.MIO.ExecuteSaveDialog;
if sFilename <> '' then
  ImageEnMView1.MIO.SaveToFile(sFileName);

// Prompt user to save a file, defaulting to TIFF format (second overloaded method)
sFilename := ImageEnMView1.MIO.ExecuteSaveDialog('Save your File', ioTIFF);
if sFilename <> '' then
  ImageEnMView1.MIO.SaveToFile(sFileName);

// Prompt user to save a file, forcing GIF format (second overloaded method)
sFilename := ImageEnMView1.MIO.ExecuteSaveDialog('Save your File', -1, ioGIF);
if sFilename <> '' then
  ImageEnMView1.MIO.SaveToFile(sFileName);

// Convert Open/Save dialogs to use modern Windows style dialog
IEGlobalSettings().UseWindowsOpenSaveDialogs := True;
sFilename := ImageEnMView1.MIO.ExecuteSaveDialog();
if sFilename <> '' then
  ImageEnMView1.MIO.SaveToFile(sFileName);