Paste HTML using pBear HtmlImport

General TRichView support forum. Please post your questions here
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

Post by Marsianin »

Ok, got it work with RichView.OnImportPicture.
But it seems OnImportPicture fires twice for the same picture. Why?
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

Post by Marsianin »

Ok, thanks for the sample, will study it.
But how can I know if last image was processed and document is ready?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply