Page 1 of 1

ActionTest demo->load document -> List index out of b

Posted: Thu Jan 30, 2014 12:40 pm
by starhu
Hello,

I need to use the ActionTest demo project as a base for the application (with multi tabbed documents).


I wanted to load an existing document. I used the following approaches but all gave the error: "List index out of bounds -1"

Approach 1.

ActiveEditor.RichViewEdit.LoadRVF('j:\Test1.rvf') ;

Approach 2.

ActiveEditor.ActiveEditor.LoadRVF('j:\Test1.rvf') ;

By the way it is very confusing that TSrRichView edit has a property named ActiveEditor and the ActionTest demo project has a variable named ActiveEditor .

Approach 3.

SRichViewEdit.ActiveEditor.LoadRVF.LoadRVF('j:\Test1.rvf') ;

Can you help me? Thank you in advance

Posted: Thu Jan 30, 2014 2:42 pm
by Sergey Tkachenko
1.
The correct way:

Code: Select all

ActiveEditor.RichViewEdit.LoadRVF('j:\Test1.rvf') ; 
ActiveEditor.Format;
I believe an exception happens because you do not call format.

2.
If you want using New, Open, Save and SaveAs actions, you must load files using TrvActionOpen1.LoadFile method:

Code: Select all

rvActionOpen1.LoadFile(ActiveEditor.RichViewEdit, 'j:\Test1.rvf', ffiRVF);
Otherwise the editor would not be associated with this file.

Posted: Tue Feb 04, 2014 12:38 pm
by starhu
Hello,

Thank you for your help. I tried it. It loads the file but it has a big problem:

1. I load the first file, let's say 'Apple.rvf'. It loads well.

2.I load the second file, 'Pear.rvf'. It loads on the second tab, but meanwhile the first tab changes from Apple.rvf to Pear.rvf !
So I have 2 tabs with Pear.rvf.

3.I load the third file, 'Cherry.rvf'. It loads on the third tab, but meanwhile the first tab and the second tab changes to Cherry.rvf.
So I have 3 tabs with Cherry.rvf.

etc.

Thank you very much

Posted: Thu Feb 06, 2014 2:09 pm
by Sergey Tkachenko
RichViewActions do not include code for tab management.
In our demos (such as ActionTestTab) all the code related to adding, renaming and closing tabs is placed in the main form unit.
I believe you used it as a base, but some mistake happened when you copied this code to your application.
If it's possible to reproduce it in a simple project, send it to me by email.

Posted: Fri Feb 07, 2014 9:36 am
by starhu
"I believe you used it as a base, but some mistake happened when you copied this code to your application. "

Your were right, thank you!