ImageEn, unit imageenio

TImageEnIO.ExecuteSaveDialog

TImageEnIO.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 = ''; DefaultFileType : TIOFileType = -1; LimitToFileType : TIOFileType = -1;
                           ShowFormats: TIEShowFormats = iesfImagesOnly; OverwritePrompt: Boolean = False) : WideString; overload;
function ExecuteSaveDialog(const Title : WideString; DefaultFileType : TIOFileType; LimitToFileType : TIOFileType = -1; AlwaysAnimate : boolean = False;
                           ShowFormats: TIEShowFormats = iesfImagesOnly; OverwritePrompt: Boolean = False) : WideString; overload;


Description

Executes the save dialog allowing the user 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. 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 DefaultFileType 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')
DefaultFileType Specify the file type that is displayed by default. This setting overrides FilterIndex, but is ignored if you have specified InitialFileName. Default is -1 (no default)
LimitToFileType Limits the filter to a specified ImageEn file type. Default is -1
ShowFormats Limit format to images, layers and/or videos (Has no effect if Filter has been specified)
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)

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 ImageEnView
sFilename := ImageEnView1.IO.ExecuteSaveDialog;
if sFilename <> '' then
  ImageEnView1.IO.SaveToFile(sFileName);

// Prompt user to save an image, defaulting to JPEG format (second overloaded method)
sFilename := ImageEnView1.IO.ExecuteOpenDialog('Save your Image', ioJPEG);
if sFilename <> '' then
  ImageEnView1.IO.SaveToFile(sFileName);

// Prompt user to save an image, forcing GIF format (second overloaded method)
sFilename := ImageEnView1.IO.ExecuteOpenDialog('Save your Image', -1, ioGIF);
if sFilename <> '' then
  ImageEnView1.IO.SaveToFile(sFileName);

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