How to save load RV Control State ?

General TRichView support forum. Please post your questions here
Post Reply
11111
Posts: 25
Joined: Sat Feb 07, 2015 12:02 pm

How to save load RV Control State ?

Post by 11111 »

I'm using TabControl in my app and every time when tab is changed i need to save and load RV content.

I can save RV content in to the stream but
how can i save and restore RV states like caret pos, selected text, scrolling pos and etc.. ?

I tried to use this but it won't work

Code: Select all

procedure TForm1.cxButton1Click(Sender: TObject);
var Str: TMemoryStream;
begin
  RegisterClass( TcxTRichViewEdit ) ;
  RegisterClass( TcxInnerTRichViewEdit ) ;
                      // TcxInnerTRichViewEdit
    Str:= TMemoryStream.Create;
   Str.WriteComponent( cxTRichViewEdit1 );
   Str.Position := 0;

  cxTRichViewEdit1 :=  Str.ReadComponent(nil) as TcxTRichViewEdit;

Str.Free;

end; 
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Selection and scrolling position is not stored in DFM.

For storing/restoring selection and caret position, use the functions from RVLinear: RVGetSelectionEx, RVSetSelectionEx, see http://www.trichview.com/help/idh_rvlinear.html

As for the scrolling position, try to store and restore cxrv.InnerEditor.VScrollPos
Post Reply