TRichview Format Error

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

TRichview Format Error

Post by DickBryant »

Hi Sergey,

I'm trying to track down a problem I'm having with the following code sequence:

FMain.RichViewEdit1.Clear;
FMain.RichViewEdit1.Format;
FMain.RVStyleQ.TextStyles.Clear;

<some intervening if/then logic here>

FMain.RichViewEdit1.Clear;
FMain.RichViewEdit1.LoadRVF(StrPas(FLSFile));
FMain.RichViewEdit1.Format;

This is the primary sequence via which each file is loaded into the program. Normally, it works just fine. BUT in an operation sequence where the program has just created a new FLS file by overwriting an older one, then closing it, and then attempting to open it, the above sequence fails with a ListIndexOutOfBounds error in FormatLine.

However, if I exit the program after the creation of the file. Then reopen the program and open the new FLS file there is no error. Can you suggest something I may need to do to 'fully initialize' the RVE so that the sequence above will work without closing the program and reopening it? When not running this particulary import sequence, the program can open and close multiple FLS files with no problem.

The current version of the program actually DOES close after this particular import operation, prompting the user to restart and open the new file to get around this issue, but I would like to remove this inconvenience.

Thanks, As Always, For Your Help
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Collections of text and paragraph styles must have at least one item.
May be this is the reason for this problem.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Yes, but the above code works fine when the imported information is from a plain-text source or from the windows clipboard. Only when the import source is from a UTF-8 'pseudo-txt' file is this problem encountered.

And then closing the program and reopening it allows the file to be loaded without a problem.

Any further thoughts? I know how hard it is to speculate on something this tenuous. I'll try tracing the error further through your source code to see if I can get some more information.
Post Reply