index error and infinite loop

General TRichView support forum. Please post your questions here
Post Reply
haroldh
Posts: 4
Joined: Wed Oct 10, 2007 2:18 am

index error and infinite loop

Post by haroldh »

tRichView 1.9.24

Sometimes when I load a document I get the following error:
EListError with message 'list index out of bound(0)'
and it looks like it is happening on line 480 of RVThread. After I OK through this error it just loops on

RVThread.pas on line 193 & 194 until I CTRL-F2

It seems to have to do something with LiveSpell but at this point I'm not 100%.

Any ideas on where I should look or what to change?
haroldh
Posts: 4
Joined: Wed Oct 10, 2007 2:18 am

Post by haroldh »

I did download and install this:
http://www.trichview.com/resources/adrv3/adrv3.zip

Also my Addict Spell checker version is 3.3.1 Pro.

Still got the error, stepping through it I found that the error pops up in CRVFData on line 5910, the GetItemCoords function call.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Try to upgrade to the latest TRichView version
haroldh
Posts: 4
Joined: Wed Oct 10, 2007 2:18 am

Post by haroldh »

I am, I am using 1.9.24. I downloaded it yesterday hoping to fix this problem. Was using 1.9.12 before.

I narrowed it down to a LiveSpelling issue. In my OnLoadDocument event I had this code:

if (AddictAutoLiveSpell.LiveSpelling) then
begin
RTFMemoPad.LiveSpellingMode:=rvlspOnChange;
RTFMemoPad.StartLiveSpelling;
end
else
RTFMemoPad.LiveSpellingMode:=rvlspManualStart;

If a document was loaded during the form's oncreate process I would get this error in a document that had a misspelling. So I changed it to this:

if (BHOActivated) and (AddictAutoLiveSpell1.LiveSpelling) then
begin
RTFMemoPad.LiveSpellingMode:=rvlspOnChange;
RTFMemoPad.StartLiveSpelling;
end
else
RTFMemoPad.LiveSpellingMode:=rvlspManualStart;

and in the form's OnActivate method I put this:

procedure TForm1.FormActivate(Sender: TObject);
begin
if not BHOActivated then
begin
if (AddictAutoLiveSpell1.LiveSpelling) then
begin
RTFMemoPad.LiveSpellingMode:=rvlspOnChange;
RTFMemoPad.StartLiveSpelling;
end;
end;
BHOActivated:=true;
end;

This way it wouldn't start the LiveSpell until the form was actually viewable. It isn't very clean but it seems to work. Could the document not have been drawn yet and thus the livespell can't find the word or something like that?
haroldh
Posts: 4
Joined: Wed Oct 10, 2007 2:18 am

Post by haroldh »

Well that didn't solve the entire problem, it still happens.

Everything works fine though if LiveSpell is turned off. But of course my users like LiveSpell so I'd love to know how to fix this.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You cannot start live spelling when the TRichViewEdit is not formatted.
You cannot start it in TDBRichViewEdit.OnLoadDocument. This event occurs after the document is loaded, but before it is formatted.

Solutions:
1)
If RTFMemoPad.LiveSpellingMode=rvlspOnChange, live spelling will start after making any change in document.
2)
You can use call RTFMemoPad.StartLiveSpelling in event occuring after the document is loaded and formatted. I think table.AfterScroll can be used.

PS: I opened access to the protected sections of this forum for you account. You can download the latest version there (1.9.24 is not the latest version)
Post Reply