Changing fonts for runtime created TRichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
tom@qualtar.co.uk
Posts: 6
Joined: Thu Jul 26, 2007 4:28 pm
Location: Birmingham

Changing fonts for runtime created TRichViewEdit

Post by tom@qualtar.co.uk »

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
tom@qualtar.co.uk
Posts: 6
Joined: Thu Jul 26, 2007 4:28 pm
Location: Birmingham

Post by tom@qualtar.co.uk »

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
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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;
Post Reply