Using RV 18.2, when I create a TRichView by clicking a button, it displays bad formatting. If I place a TRichView on a form, it displays correctly.
Steps: Create TRvStyle, create TRichView, attach Style, call LoadRTF, call Reformat.
What are the requirements to instantiate a TRichView run-time?
Does anyone have a sample that does that?
I tried to attach a sample, but the forum says the file is too large (0.9MB)...
Regards,
Thomas
Run-time creation of TRichView formatting wrong in display
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Run-time creation of TRichView formatting wrong in display
Initial values of some properties are different for TRichView components created at runtime and placed on a form at designtime.
Initial values of properties for components created at designtime can be set using a component editor (right click TRichView in Delphi IDE and choose "Settings" in the popup menu).
Initial values of properties for components created at runtime are different, I cannot change them for a backward compatibility reason.
To load RVF and RTF properly, I suggest making the following property changes:
Initial values of properties for components created at designtime can be set using a component editor (right click TRichView in Delphi IDE and choose "Settings" in the popup menu).
Initial values of properties for components created at runtime are different, I cannot change them for a backward compatibility reason.
To load RVF and RTF properly, I suggest making the following property changes:
Code: Select all
var
rv: TRichView;
begin
rv := TRichView.Create(Self);
rv.Style := TRVStyle.Create(rv);
rv.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
rv.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
rv.RVFOptions := rv.RVFOptions + [rvfoSaveTextStyles, rvfoSaveParaStyles,
rvfoLoadTextStyles, rvfoLoadParaStyles,
rvfoSaveLayout, rvfoLoadLayout,
rvfoSaveBack, LoadBack];
Re: Run-time creation of TRichView formatting wrong in display
Thanks Sergey, it works after I applied your suggestions.
I couldn't find rvfoLoadTextStyles and rvfoLoadParaStyles, but it works without that!
Since you already have a Manual, you could add a section to it named "Programmactically creating RichView components"...
Thanks,
Thomas
I couldn't find rvfoLoadTextStyles and rvfoLoadParaStyles, but it works without that!
Since you already have a Manual, you could add a section to it named "Programmactically creating RichView components"...
Thanks,
Thomas