Canvas does not allow drawing occassionally

General TRichView support forum. Please post your questions here
Post Reply
EricNat
Posts: 12
Joined: Mon Feb 17, 2014 7:43 pm

Canvas does not allow drawing occassionally

Post by EricNat »

I am creating a TRichView dynamically and assigning its parent to the main form. Then using

RV->LoadHTMLFromStream(s);
RV->Format();

to load in HTML. This generally works but every so often I get a "Canvas does not allow drawing" exception. Note that this is a multi-threaded server app but I do have the process wrapped in a critical section.

My understanding is that there is no way to do this "headless". In other words, it requires a parent form (even if it's set to not be visible). Is that true? Is there any way to run it headless? Not sure if that would solve this issue or if it's unrelated to that.

Using the latest version of the component.

Thanks.
Sergey Tkachenko
Site Admin
Posts: 17844
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Canvas does not allow drawing occassionally

Post by Sergey Tkachenko »

TRichView need a parent form for formatting. The form may be hidden.
The alternative is using TRVReportHelper component. It contains invisible TRichView inside (accessible as RichView property) that does not need a parent form. TRVReportHelper must be formatted using RVReportHelper.Init method (instead of RVReportHelper.RichView.Format).

PS: while HTML loading can be done in a background thread, I am not sure about formatting (I never tried it).
Not all operations require formatting. It is needed for displaying, working with selection, exporting to RTF and DocX. Other operations can be done without formatting,
Post Reply