Page 1 of 1

Changing fonts for runtime created TRichViewEdit

Posted: Wed Aug 01, 2007 12:29 pm
Hello Sergey,

I have created a runtime array of TRichViewEdit objects, each with its own TRVStyle but I cannot change the font.

I have copied the code from Editor 2. That works fine for design time objects but not for runtime objects.

Can you tell me how to do it?

Regards

Thomas Davenport

Posted: Fri Aug 03, 2007 6:00 am
Done it.

I copied the event handlers supplied in Editor 2, modified them to work with array elements and assigned them at runtime.

The only extra thing I have had to do is to de-select any selected text as you move from panel to panel.

Regards

Thomas Davenport

Posted: Fri Aug 03, 2007 11:25 am
by Sergey Tkachenko
One note: initial values of TRichViewEdit properties are different for components placed on form at designtime and for components created at runtime.
For components placed on form at designtime, initial values are defined in the component editor (right click, "Settings").
For components created in code, initial values do not allow to load/save documents in RTF and RVF correctly, if you add new styles, like in Editor2 demo.
When you create documents at runtime, assign:

Code: Select all

rv.RVFOptions := rv.RVFOptions+[rvfoSaveTextStyles, rvfoSaveParaStyles]; // you may wish to add other options
rv.RVFTextStylesReadMode := rvf_sInsertMerge;
rv.RVFParaStylesReadMode := rvf_sInsertMerge;
rv.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
rv.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;