RVA file operations; misc.

General TRichView support forum. Please post your questions here
Post Reply
intis
Posts: 11
Joined: Mon Mar 23, 2009 7:45 pm

RVA file operations; misc.

Post by intis »

Hi,
I disabled all the filters (ffiRVF ... ffiTextAuto) except ffiCustom
for the file actions SaveAs and Open and set some file types in CustomFilter. In the Open and SaveAs dialogs, all "custom file types" are visible as designed. (Custom file types are IRF (=RVF), RTF, TXT.)

In this context, two problems rise:
#1 RVAControlPanel1CustomFileOperation does not fire when clicking the Save, SaveAs or Open button (inspite of being defined/assigned to the RVA control panel).

#2 It is not possible to save the document in any format (after clicking the Save or SaveAs button).
Always the built in error message "error saving file ..." appears.
--------

#3 print preview: How to set the zoom factor programmically ?

#4 I enclose the RVE/RVA form in a "form container" (JvEmbeddedFormPanel from Jedi VCL). Therefore, no menu and no title/caption are visible so far _[i]at runtime[/i]_ . Have you a hint how to make the menu and the filename visible anyway ?

#5 How to get such a design of the left border of the document as in README.RVF in the RV ActionTest demo application ?


Thank you for some help !
Regards
Intis
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

3) TrvActionPrintPreview does not allow assigning a custom initial zoom factor (you can only choose whether to display the form maximized or not).
The only solution - to create your own form inherited from TfrmRVPreview, and return its class in OnGetPreviewFormClass event.

4) Use TrvActionSave.OnDocumentFileChange event to determine when the file name is changed. The ActionTest demo uses this event to assign the file name to the form's caption, but you can assign it to any control.

5) This document has a large left margin (RichViewEdit.LeftMargin) and a background bitmap. The user can define them in Format | Background command.
In this dialog, RichViewEdit's margins are called "Padding" (to distinguish them from TRVPrint's page margins defined in File | Page Setup).
To store these values in RVF document, include rvfoSaveBack, rvfoLoadBack, rvfoSaveLayout, rvfoLoadLayout in RichViewEdit1.RVFOptions (do it even if you do not use RVF, because these options are used by RichViewActions too).

As for 1-3, I'll test and answer tomorrow.
intis
Posts: 11
Joined: Mon Mar 23, 2009 7:45 pm

Post by intis »

Thank you so far !
Best regards
Intis
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In my tests, all works as expected.

I made the following:
1) In TrvActionOpen and TrvActionSaveAs, I excluded all values except for "custom".
2) In these actions, I assigned CustomFilter property = 'IRF Files|*.irf|RTF Files|*.rtf|Text Files|*.txt'
3) Assigned OnCustomFileOperation:

Code: Select all

procedure TForm3.RVAControlPanel1CustomFileOperation(Sender: TrvAction;
  Edit: TCustomRichViewEdit; const FileName: String;
  Operation: TRVAFileOperation; var SaveFormat: TrvFileSaveFilter;
  var CustomFilterIndex: Integer; var Success: Boolean);
begin
  case Operation of
    rvafoOpen: Success := Edit.LoadRVF(FileName);
    rvafoSave: Success := Edit.SaveRVF(FileName, False);
  end;
end;
In addition, to provide the proper work of the "File | New" command, I changed DefaultFileName, DefaultExt, DefaultFileFormat, and DefaultCustomFilterIndex.
After that, IRF files were created, opened and saved successfully.

PS: If you just need to rename RVF to IRF, there is a simpler way.
Change the following properties of TRVAControlPanel:
DefaultExt = 'irf'
DefaultFileName = 'Untitled.irf'
RVFLocalizable = False
RVFFilter = 'IRF Files (*.irf)|*.irf'
RVFormatTitle = 'IR Document'
intis
Posts: 11
Joined: Mon Mar 23, 2009 7:45 pm

Post by intis »

Thank you !
For me, the most important part of your mail is the "PS".
Indeed, the only purpose was the mapping RVF --> IRF.
(The approach I tried was inspired by elder contributions in this forum - but RVFFilter is described in the readme.rvf ... )

I like to return to problem concerning the display of the current filename:
I guess, I had also to use the TrvActionOpen.OnOpenFile event if I like to display the current filename (?).
But if opening the file fails, I had a wrong filename there (?!).

Would it be a problem to implement a RVE property "CurrentFilename" ?

Best regards
Intis
Post Reply