Page 2 of 2
Posted: Fri Jan 08, 2010 6:31 am
by Marsianin
Ok, got it work with RichView.OnImportPicture.
But it seems OnImportPicture fires twice for the same picture. Why?
Posted: Fri Jan 08, 2010 7:16 am
by Marsianin
Tree more questions:
1. Is there a way to get amount of images to be loaded before loading them?
2. Is there a way to show imported HTML document before loading images like Internet browser does?
3. How can I know if all images are loaded and document ready?
Posted: Mon Jan 11, 2010 6:06 pm
by Sergey Tkachenko
In the current implementation, images are loaded sequentially, one by one.
When the parser encounters an image, it invokes the event for loading this picture, and waits while you load/download the picture in this event, then inserts it in TRichView.
However, you can implement threaded loading. But you need to do it yourself.
In OnImportPicture, you need to return a placeholder (some temporal picture) and create a thread for downloading. When the picture is downloaded, replace this placeholder to the downloaded picture.
A couple years ago I created a demo for TrvHtmlImporter:
http://trichview.com/resources/html/rvh ... hreads.zip
You can use it as a base for your code.
Posted: Mon Jan 11, 2010 6:48 pm
by Marsianin
Ok, thanks for the sample, will study it.
But how can I know if last image was processed and document is ready?
Posted: Tue Jan 12, 2010 9:27 am
by Sergey Tkachenko
In this example, you create threads yourself. So the last image is downloaded when the count of threads becomes zero.
Without threads, all images are loaded when the method for HTML loading finishes its work.