| View previous topic :: View next topic |
| Author |
Message |
Marsianin
Joined: 25 Sep 2005 Posts: 127
|
Posted: Fri Jan 08, 2010 6:31 am Post subject: |
|
|
Ok, got it work with RichView.OnImportPicture.
But it seems OnImportPicture fires twice for the same picture. Why? |
|
| Back to top |
|
 |
Marsianin
Joined: 25 Sep 2005 Posts: 127
|
Posted: Fri Jan 08, 2010 7:16 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
Sergey Tkachenko Site Admin
Joined: 27 Aug 2005 Posts: 6599
|
Posted: Mon Jan 11, 2010 6:06 pm Post subject: |
|
|
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/rvhtml_indy_threads.zip
You can use it as a base for your code. |
|
| Back to top |
|
 |
Marsianin
Joined: 25 Sep 2005 Posts: 127
|
Posted: Mon Jan 11, 2010 6:48 pm Post subject: |
|
|
Ok, thanks for the sample, will study it.
But how can I know if last image was processed and document is ready? |
|
| Back to top |
|
 |
Sergey Tkachenko Site Admin
Joined: 27 Aug 2005 Posts: 6599
|
Posted: Tue Jan 12, 2010 9:27 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|