Substitute RichViewEdit in TSRichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Substitute RichViewEdit in TSRichViewEdit

Post by vit »

Hi!

I whant write descendant to TRichViewEdit and override several methods. And futher I'm going to substitute standart TRichViewEdit by it in TSRichViewEdit.

Can I use ExternalRV property for this purpose?
I can't understand how exactly use it. Wich properties of external RVE I should set?


Example

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  ExRVE: TRichViewEdit;
begin
  ExRVE := TMyRichViewEdit.Create(Self);
  ExRVE.Style := RVS;
  SRVE.ExternalRV := ExRVE;
end;
It doesn't work becouse ExRVE.Parent is not assigned. Can you please give me example of using ExternalRV?

Thank you!
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Post by vit »

Ok, I found now \Demos\Basic Demos\External RichView

As I see ExternalRV is not for substituting of editors of TSRichViewEdit... And is no other ways to substitute TSRichViewEdit? I mean that new RVE should be inside TSRichViewEdit instead of usual RichViewEdit, not somewhere at the side..
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Post by vit »

Or if it is impossible may be there is a way to substitute RVData of TRichViewEdit? Becouse it also contains virtual methods wich I whant override.
Sergey Tkachenko
Site Admin
Posts: 17309
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

To change RVData class, override GetDataClass method of TRichViewEdit. Of course, it requires creating a component inherited from TRichViewEdit or TCustomRichViewEdit.
However, when editing a table cell, an inplace editor is created. This editor has TRVTableInplaceEdit class and cannot be changed. It has its own RVData of TRVTableInplaceRVData class.

As for TSRichViewEdit, there are two methods for changing its RichViewEdit.
First, using external TRichViewEdit. It must be placed on a form, but should be hidden. This external editor can be used instead of the build-in editor.
Second, you can create a component inherited from TSRichViewEdit and override CreateRichViewEditObject method.
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Post by vit »

Thank you for answer.
Sergey Tkachenko wrote: First, using external TRichViewEdit. It must be placed on a form, but should be hidden. This external editor can be used instead of the build-in editor.
There is one strange thing.
When I did this:
1. Added TSRichViewEdit on the form (SRVE)
2. Added TRVStyle on the form (RVS)
3. Added TRichViewEdit on the form (RVE) (below SRVE)
4. Assigned SRVE.ExternalRVStyle to RVS
5. Assigned RVE.Styles to RVS
6. Maked RVE invisible
7. Assigned SRVE.ExternalRV to RVE
8. Compiled and runed application
9. Typed some text
10. Performed text drag drop with copying

Invisible RVE was showed. Is this bug or I did something wrong?
Sergey Tkachenko
Site Admin
Posts: 17309
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I discussed this situation with Ilya, he said that it is unavoidable.
He suggest to place this RichViewEdit on a TPanel, then set the size of this panel 0x0
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Post by vit »

When I do it in designtime all works fine. But in runtime SRVE looks like this:

Image

It seems like RVE was placed at left field of page.

There is the code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  RVE: TRichViewEdit;
begin
  RVE := TMyRVE.Create(SRVE);
  RVE.Style := RVS;
  SRVE.ExternalRV := RVE;
  RVE.Visible := False;
  RVE.Parent := Panel1;
end;
What should I do to assign external RVE correct in designtime?

Tahnk you!
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

need to apply the properties of SRV to RV, using RefreshData

Code: Select all

procedure TForm1.FormCreate(Sender: TObject); 
...
  SRVE.ExternalRV := ExRVE; 
  SRVE.RefreshData;
end; 
Post Reply