Page 1 of 1

EListError On TRichViewEdit.Format

Posted: Wed Jan 17, 2007 5:58 pm
by DickBryant
This one's driving me nuts!

I create a document consisting of a table loaded with various entries (some of which are Unicode). I save the table to a file then call

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

the code fails on the Format with EListError on this line with List Index Out Of Bounds (0)

FormatLine(
RV_ReturnProcessedString(Items,
RVStyle.TextStyles[GetActualStyleNo(RVStyle)], False,
rvoShowSpecialCharacters in Options, False),
Items, 0,
{$IFNDEF RVDONOTUSEUNICODE}
RVU_Length(Items, ItemOptions),
{$ELSE}
Length(Items),
{$ENDIF}
i, Canvas, sad, Params)

BUT - if I close the program and reopen it and then open the saved file (using the same code as above) it operates perfectly??

Any suggestions?

Dick

Posted: Thu Jan 18, 2007 11:38 am
by Sergey Tkachenko
Can this error be reproduced when loading this file in Editor1 demo on in the ActionTest?

Posted: Thu Jan 18, 2007 1:56 pm
by DickBryant
No - if I pause the program in the IDE right after it saves the file and open the file with ActionTest.exe it opens just fine - just like it does using my own program IF I close the program first (that's the current work-around, but I'd like to get rid of it).

Can this error be caused by settings in the RVStyle? I _believe_ RVStyle has been cleared before attempting to load the saved file into RichViewEdit1 using the referenced code.

Dick

Posted: Thu Jan 18, 2007 2:25 pm
by Sergey Tkachenko
1) Send me this file
2) Is this really the line of code generating the exception? Compile your project without optimization and with stack frames (see project's options, compiler)