ImageEn, unit iemio

TImageEnMIO.ExecuteOpenDialog

TImageEnMIO.ExecuteOpenDialog


Declaration


function ExecuteOpenDialog(const InitialDir : WideString = ''; const InitialFileName : WideString = ''; AlwaysAnimate : boolean = False;
                           FilterIndex: integer = 0; const ExtendedFilters : WideString = ''; MultiSelect : boolean = False;
                           const Title : WideString = ''; const Filter : WideString = ''; DefaultFilter : TIOFileType = -1;
                           LimitToFileType : TIOFileType = -1) : String; overload;
function ExecuteOpenDialog(const Title : WideString; DefaultFilter : TIOFileType; LimitToFileType : TIOFileType = -1; AlwaysAnimate : boolean = False; MultiSelect : boolean = False) : String; overload;


Description


Prompts the user with the open dialog to select an image to load. 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 (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: GIFHowever, 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')
MultiSelect Allow selection of multiple files. The returned string will contain a list of filename separated by the "|" character (e.g. 'C:\one.jpg|C:\two.jpg')
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, plus "All Supported Types" and "All Files" (only relevant if Filter is not set)


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


Examples


// Prompt to load a file into an ImageEnMView
sFilename := ImageEnMView1.MIO.ExecuteOpenDialog;
if sFilename <> '' then
  ImageEnMView1.MIO.LoadFromFile(sFileName);

// Prompt to load a file, defaulting to AVI format (second overloaded method)
sFilename := ImageEnMView1.MIO.ExecuteOpenDialog('Select your video', ioAVI);
if sFilename <> '' then
  ImageEnMView1.MIO.LoadFromFile(sFileName);

// Prompt to load a file, forcing GIF format (second overloaded method)
sFilename := ImageEnMView1.MIO.ExecuteOpenDialog('Select an Image', -1, ioGIF);
if sFilename <> '' then
  ImageEnMView1.MIO.LoadFromFile(sFileName);