TImageEnIO.ExecuteOpenDialog
Declaration
function ExecuteOpenDialog(const InitialDir : WideString = ''; const InitialFileName : WideString = ''; AlwaysAnimate : boolean = False;
FilterIndex: Integer = 0; const ExtendedFilters : WideString = ''; const Title : WideString = '';
const Filter : WideString = ''; DefaultFileType : TIOFileType = ioNone; LimitToFileType : TIOFileType = ioNone;
ShowFormats: TIEShowFormats = iesfImagesOnly) : WideString; overload;
function ExecuteOpenDialog(const Title : WideString; DefaultFileType : TIOFileType; LimitToFileType : TIOFileType = ioNone; AlwaysAnimate : boolean = False;
ShowFormats: TIEShowFormats = iesfImagesOnly) : WideString; overload;
Description
Executes the open dialog allowing the user to browse for an image file. It encapsulates the
TOpenImageEnDialog 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 ioNone (-1) |
LimitToFileType | Limits the filter to a specified ImageEn file type, plus "All Supported Types" and "All Files" (only relevant if Filter is not set). Default is ioNone (-1) meaning all types are shown |
ShowFormats | Limit format to images, layers and/or videos (Has no effect if Filter has been specified) |
Returns a null string ('') if the user clicks Cancel.
Note: An ImageEn
open dialog will be used. To use a standard Windows Open dialog, enable
UseWindowsOpenSaveDialogs// Prompt user to load a file into an ImageEnView
sFilename := ImageEnView1.IO.ExecuteOpenDialog();
if sFilename <> '' then
ImageEnView1.IO.LoadFromFile(sFileName);
// Prompt user to load an image, defaulting to JPEG format (second overloaded method)
sFilename := ImageEnView1.IO.ExecuteOpenDialog('Select an Image', ioJPEG);
if sFilename <> '' then
ImageEnView1.IO.LoadFromFile(sFileName);
// Prompt user to load an image, forcing GIF format (second overloaded method)
sFilename := ImageEnView1.IO.ExecuteOpenDialog('Select an Image', -1, ioGIF);
if sFilename <> '' then
ImageEnView1.IO.LoadFromFile(sFileName);
// Convert Open/Save dialogs to use modern Windows style dialog
IEGlobalSettings().UseWindowsOpenSaveDialogs := True;
sFilename := ImageEnView1.IO.ExecuteOpenDialog();
if sFilename <> '' then
ImageEnView1.IO.LoadFromFile(sFileName);
See Also
◼ExecuteSaveDialog◼Filename