trichview.com Forum Index trichview.com
TRichView support forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Paste HTML using pBear HtmlImport
Goto page Previous  1, 2
 
Post new topic   Reply to topic    trichview.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Marsianin



Joined: 25 Sep 2005
Posts: 127

PostPosted: Fri Jan 08, 2010 6:31 am    Post subject: Reply with quote

Ok, got it work with RichView.OnImportPicture.
But it seems OnImportPicture fires twice for the same picture. Why?
Back to top
View user's profile Send private message
Marsianin



Joined: 25 Sep 2005
Posts: 127

PostPosted: Fri Jan 08, 2010 7:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 6599

PostPosted: Mon Jan 11, 2010 6:06 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Marsianin



Joined: 25 Sep 2005
Posts: 127

PostPosted: Mon Jan 11, 2010 6:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 6599

PostPosted: Tue Jan 12, 2010 9:27 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    trichview.com Forum Index -> Support All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group