Page 1 of 1

Substitute RichViewEdit in TSRichViewEdit

Posted: Fri Oct 08, 2010 8:19 am
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!

Posted: Fri Oct 08, 2010 9:12 am
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..

Posted: Fri Oct 08, 2010 10:50 am
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.

Posted: Fri Oct 08, 2010 5:27 pm
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.

Posted: Mon Oct 11, 2010 6:56 am
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?

Posted: Mon Oct 11, 2010 7:21 am
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

Posted: Mon Oct 11, 2010 9:24 am
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!

Posted: Tue Oct 12, 2010 7:42 am
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;