File name and save before opening the RVE.

General TRichView support forum. Please post your questions here
Post Reply
adilsonp
Posts: 7
Joined: Fri Jan 22, 2016 11:09 am

File name and save before opening the RVE.

Post by adilsonp »

Hi Sergey,

We're testing your component and can not find help on a feature that does not display the save message to close a changed document, whether new or already established.

When you open the RVE, it must open a document? Whether existing or blank?

Our application requires to open the RVE, first you must include the file name, description and other information, which will be saved in the RVF properties.

Is there any possibility of creating a document, name it, save the information in the file in memory, and then display the RVE.

Today, in our tests, we open the RVE with a blank document, we include the information and save the document with another name, but the open document does not close the blank document and open it created, a message appears asking if you want to save changes to the file. That is, the RVF has been saved under another name, but not updated to include the name.

 Would you have any suggestions?

Grateful

Adilson
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1) In RichViewActions, if you want to associate TRichViewEdit with some existing file, the simplest way is to load it using TrvActionOpen1.LoadFile.
You can see how it is done in the ActionTest demo with readme.rvf

2) If you want to associate TRichViewEdit with a file without loading it, the code is:

Code: Select all

var
  DocInfo: TrvaDocumentInfo;
begin
  rvActionNew1.ExecuteTarget(RichViewEdit1);
  DocInfo := rvActionSave1.GetDoc(RichViewEdit1);
  DocInfo.Defined := True;
  DocInfo.FileName := ExtractFilePath(Application.ExeName) + 'samplefile.rvf';
  if Assigned(rvActionSave1.OnDocumentFileChange) then
    rvActionSave1.OnDocumentFileChange(rvActionSave1, RichViewEdit1,
      DocInfo.FileName, DocInfo.FileFormat, False);
end;
Post Reply