Hello!
My company purchased like 10 years ago or so the 1.0 version of richview. We are now planning to purchase the last version and migrate to scalerichview.
Playing with the demos and trials i only see one big barrier.
We were using 3 richviewedits for body,header and footer with theirs own styles. Our styles are defined BEFORE the form shows where we make the preprocessing , so StartEditing(srvHeader) is not a option.
I have tried using ExternalRVStyleHeader, Subdocuments.MainStyle and RVHeader.Style, but all of them got replaced the moment you start editing the header.
I also noticed it got deleted if you do "format", so maybe i'm deleting it somehow and i don't know. If i check right before editing header it seems fine though.
The question would be:
¿Can i still create a RVStyle for header in code before the form shows on ScaleRichView? ¿What function replace the header style?
Thank you for reading.
Issue with ScaleRichView
-
- Site Admin
- Posts: 17571
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You are right, in the new version, when a header editing is activated, styles from the proper SRV.SubDocuments[].GetRVStyle are copied to SRV.RVHeader.Style.
The solution is assigning styles of SRV.SubDocuments[] when a new document is created.
Normally, a new document is created using rvActionNew.Execute or rvActionOpen.LoadFile.
In the both cases, rvActionNew.OnNew event occurs.
In this event, you can assign default properties of SRV.SubDocuments[].GetRVStyle for all subdocuments.
The solution is assigning styles of SRV.SubDocuments[] when a new document is created.
Normally, a new document is created using rvActionNew.Execute or rvActionOpen.LoadFile.
In the both cases, rvActionNew.OnNew event occurs.
In this event, you can assign default properties of SRV.SubDocuments[].GetRVStyle for all subdocuments.
I found it
srvActionsResource.rvActionNew1.OnNew:=eventActionOnNew;
http://www.trichview.com/help-actions/i ... _onnew.htm
The problem persist because this is not being called, ill test it a little more.
srvActionsResource.rvActionNew1.OnNew:=eventActionOnNew;
http://www.trichview.com/help-actions/i ... _onnew.htm
The problem persist because this is not being called, ill test it a little more.
-
- Site Admin
- Posts: 17571
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Do you use RichViewActions?
If you use New, Open, Save, SaveAs actions, you should start either from executing New or from loading a file using Open, to associate the editor with a file.
If you do not use these actions, you create your document yourself. Place the code for assigning styles of SRV.SubDocuments.GetRVStyle where you create a new document (in FormCreate?)
If you use New, Open, Save, SaveAs actions, you should start either from executing New or from loading a file using Open, to associate the editor with a file.
If you do not use these actions, you create your document yourself. Place the code for assigning styles of SRV.SubDocuments.GetRVStyle where you create a new document (in FormCreate?)
Yes i think i got it.
All is done manually, probably using RichViewActions would cut the size of the code in half.
Not probably the best way to do it but what i did is save the style and add the missing textstyles onChangeActiveEditor. I'm still not sure how to modify SRV.SubDocuments.GetRVStyle as you said but this works and its all i need to show the editor to the boss. If we buy we will talk again and will discuss the best way
Thank you for your time.
PD: Sorry for bad english.
All is done manually, probably using RichViewActions would cut the size of the code in half.
Not probably the best way to do it but what i did is save the style and add the missing textstyles onChangeActiveEditor. I'm still not sure how to modify SRV.SubDocuments.GetRVStyle as you said but this works and its all i need to show the editor to the boss. If we buy we will talk again and will discuss the best way
Thank you for your time.
PD: Sorry for bad english.
-
- Site Admin
- Posts: 17571
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
OnChangeActiveEditor occurs every time when you switch between the main document, footer, header, text box, footnote, endnote.
It may be used as a quick and dirty solution, but should not be used in the actual application to modify styles, because it may occur after header/footer is already edited.
You need to define styles when your editor is initialized.
For example. Create a new application. Place SRichViewEdit1: TSRichViewEdit on a form. Add the code in FormCreate:
Run the application.
Start editing the header. You will see its text is blue.
It may be used as a quick and dirty solution, but should not be used in the actual application to modify styles, because it may occur after header/footer is already edited.
You need to define styles when your editor is initialized.
For example. Create a new application. Place SRichViewEdit1: TSRichViewEdit on a form. Add the code in FormCreate:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
with SRichViewEdit1.SubDocuments[srvhftNormalHeader].GetRVStyle do
begin
TextStyles.Clear;
TextStyles.Add.Color := clBlue;
end;
SRichViewEdit1.Format;
end;
Start editing the header. You will see its text is blue.