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
 TImageEnMView.OnProgress ?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Alexey

1 Posts

Posted - Mar 13 2013 :  12:10:11  Show Profile  Reply
Hello

If I use just TImageEnView.IO.LoadFromFile then the event OnProgress occurs many times during big file loading and allows to show a real I/O progress for File Loading. But If I use TImageEnMView.MIO.LoadFromFile then OnProgress handler is called only two times for 0 and 100 %.
Is there any way to get a real/smooth file loading progress from TImageEnMView.MIO. I use it to load multipage TIFF files.

Thanks.

w2m

USA
1990 Posts

Posted - Mar 15 2013 :  10:30:47  Show Profile  Reply
This is because either the multipage tif pages are loading very quickly, or the progressbar is not being refreshed to show the change. One way you can control this by doing this:
procedure TForm1.ImageEnMView1Progress(Sender: TObject; per: Integer);
begin
  // Make sure ProgressBar1.Max is 100 before loading the file
  // Set the progressbar position
  ProgressBar1.Position := per;
  // Without this the progress may be too fast to see progress bar changes visually
  // Adjust this sleep time to control the speed of loading
  Sleep(500);  
  // Update the progressbar
  Application.ProcessMessages;
end;

procedure TForm1.ImageEnMView1FinishWork(Sender: TObject);
begin
 //Themed progressbars may not be refreshed fully as the progress nears completion.  This can be improved by using this code or by using a third party progressbar:
 ProgressBar1.Position := 100-1;
 ProgressBar1.Position := 100;
 ProgressBar1.Position := 100-1;
 Sleep(500);
 ProgressBar1.Position := 0;
end;

Another but much more difficult way is to update the progressbar in a thread.

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: