save, load, insert custom controls to/from stream

General TRichView support forum. Please post your questions here
Post Reply
lwinter
Posts: 24
Joined: Thu Dec 01, 2005 4:42 am

save, load, insert custom controls to/from stream

Post by lwinter »

Hi Sergey,
can you please help with this:

Aim:
To insert HTML (which contains custom control tags) to caret position/curr. selection.

Problem:
As RvHtmlImport only allows to LoadHtml (replace all or append) but not insert, I tried to use SaveRVF[RTF]ToStream, LoadRVF[RTF]FromStream and InsertRVF[RTF]FromStreamEd.

Saving and loading RVF or RTF to and from streams runs into problems when the RichView contains custom controls (our own subclasses of TGraphicControl).

e.g.
CRVFData -> GetParaBounds throws index out of bounds;
RVFMisc -> RVFLoadControl[Binary] throws "... exception class EClassNotFound with message 'Class [our custom control] not found' ..."

Question:
What is the best way to do an insert of HTML that contains custom-control tags? (I already modified the RvHtmlImport to parse for and create custom controls, so the LoadHtml works fine)
Alternatively, what is the best way to get saving, loading and inserting of RVF to and from streams - including custom controls - working?

many thanks,
-- Lutz
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1) About HTML insertion: load HTML in a hidden TRichView, then save the document using SaveRVFToStream and insert to the caret position using InsertRVFFromStreamEd. RichViewActions do it in this way.

2) About RVF loading problems. Call RegisterClass for class of each control that must be loaded from RVF.
Post Reply