TCustomRichViewEdit.LoadRVF Sometimes Fail

General TRichView support forum. Please post your questions here
Post Reply
padbotz
Posts: 6
Joined: Mon Apr 27, 2009 3:31 am

TCustomRichViewEdit.LoadRVF Sometimes Fail

Post by padbotz »

Hi,


Anybody here have an idea why the LoadRVF sometimes returns false? What are the factors that affects this? I've been trying to load a file which was being saved using SaveRVF..

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

Post by Sergey Tkachenko »

One of the most possible reasons:
- document includes unregistered graphic class or control; TBitmap, TIcon, TMetafile and TJPEGImage do not need to be registered; for other graphic classes, as well as for all components inserted in the document, call RegisterClass, one time, before the first loading:
RegisterClass(TButton);
RegisterClass(TGifImage)
- styles are not saved in RVF and changed after saving:
* make sure each TRichViewEdit is linked to its own TRVStyle
* right click at TRichViewEdit at design time, choose Settings in the popup menu, make sure that "Allow adding styles dynamically" is set;
padbotz
Posts: 6
Joined: Mon Apr 27, 2009 3:31 am

Post by padbotz »

Thank you so much sir for the reply..

Actually, my RichViewEdit is created at runtime & has its own style, could you pls check if the ff. options are fine during creation?:

-------------------------------------------------------
Options := [rvoAllowSelection, rvoScrollToEnd, rvoClientTextWidth, rvoShowPageBreaks,
rvoTagsArePChars, rvoAutoCopyText, rvoAutoCopyUnicodeText, rvoAutoCopyRVF, rvoAutoCopyImage,
rvoAutoCopyRTF, rvoFormatInvalidate, rvoDblClickSelectsWord, rvoRClickDeselects];
RTFOptions := [rvrtfSaveEMFAsWMF, rvrtfSaveJpegAsJpeg];
RTFReadProperties.UnicodeMode := rvruMixed;
RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
RVFOptions := [rvfoSavePicturesBody, rvfoSaveBinary, rvfoSaveControlsBody, rvfoSaveBack,
rvfoLoadBack, rvfoSaveTextStyles, rvfoSaveParaStyles, rvfoSaveLayout, rvfoLoadLayout, rvfoSaveDocProperties,
rvfoLoadDocProperties];
-------------------------------------------------------

Based on what you've said about RegisterClasses, i'm doubting now my custom classes that will be inserted in the RichViewEdit, the RegisterClasses are in its own individual unit's Initialization.. Example:

-------------------------------------------------------
TCustomClass1 = class(TPanel)
private
...
...
end
...

initialization
RegisterClasses([TCustomClass1]);
end;
-------------------------------------------------------

Does this mean that i should transfer this to the unit in the Initialization section of the unit where the RichViewEdit is created? And should I include all the used classes (whether custom or not) inside that unit?


Thanks again in advance sir..
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It does not matter where you call RegisterClasses.
Calling them in your unit is ok.

PS: if your panel contains other components, they must be registered as well.
padbotz
Posts: 6
Joined: Mon Apr 27, 2009 3:31 am

Post by padbotz »

Only visual components must be registered right?
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, any component that can be stored in RVF.
padbotz
Posts: 6
Joined: Mon Apr 27, 2009 3:31 am

Post by padbotz »

Thank you so much for your help sir..
Post Reply