ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 MIO.ExecuteOpenDialog: MultiSelect parameter
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Jan 18 2023 :  14:52:44  Show Profile  Reply
When I select multiple multi-frame images (e.g. TIFF) in the MIO.ExecuteOpenDialog:

var filename := ImageEnMViewMultiImages.MIO.ExecuteOpenDialog(
    'Select Multi-Frame Images',  // Title
    -1,                           // DefaultFilter
    -1,                           // Limit To FileType
    True,                         // Always Animate
    True,                         // MultiSelect !!!
    iesfMultiImagesOnly);         // ShowFormats

  if filename <> '' then
  begin
    // ERROR if multiple files are selected:
    ImageEnMViewMultiImages.MIO.LoadFromFile(filename);
  end;


If MultiSelect = True in MIO.ExecuteOpenDialog, the multiple files are separated by a '|' character. Do I have to separate these files manually, or is there a built-in method to AUTOMATICALLY load all the multiple selected files in the ImageEnMViewMultiImages control?

xequte

38615 Posts

Posted - Jan 18 2023 :  23:01:51  Show Profile  Reply
Hi Peter

Please use LoadFromFiles:

// Execute the open dialog and load the returned list of selected files
filenames := ImageEnMView1.MIO.ExecuteOpenDialog('', '', true, 1, '', true);
ImageEnMView1.MIO.LoadFromFiles(filenames);


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

933 Posts

Posted - Jan 19 2023 :  03:10:50  Show Profile  Reply
Hi Nigel,

Thanks for the information. As LoadFromFiles can be used for any number of loaded files (both single files and multiple files), is there also a built-in method to get the NUMBER OF LOADED FILES?
Go to Top of Page

PeterPanino

933 Posts

Posted - Jan 19 2023 :  03:26:23  Show Profile  Reply
Meanwhile, I use this workaround:

function OccurrencesOfChar(const S: string; const C: Char): Integer;
begin
  Result := 0;
  for var i := 1 to Length(S) do
  begin
    if S[i] = C then
      Inc(Result);
  end;
end;

var LoadedFilesCount := OccurrencesOfChar(filenames, #124) + 1;
CodeSite.Send('LoadedFilesCount', LoadedFilesCount);


Is this reliable and correct?
Go to Top of Page

xequte

38615 Posts

Posted - Jan 19 2023 :  13:50:03  Show Profile  Reply
Hi Peter

Your code looks correct, and should be reliable.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: