For your reference I am using Delphi 2009. I'm compiling with Debug options.
When I used your new code, I again got an Access Violation exception at run time, this time on the "Count := 0" line. I don't develop components or classes so I have no idea why this might be.
What I did to get around it was to eliminate the TRVSelection type, and just declare the private variables of that class locally, and I took the "TRVSelection." off the GetFromRichViewEdit and SetToRichViewEdit procedure names.
After I did this, then it starting running correctly. Hooray!
Once it reached a table, it then gave me a runtime exception: "Invalid Class Type cast". It didn't like the two "as TRVTableItemInfo" typecasts, so I changed them to an "as TCustomRVItemInfo" and enclosed them within a "TRVTableItemInfo(...)" cast. That worked.
Finally to complete this, if I added or deleted items prior to the selection (and for me these are ALWAYS items at the top level, i.e. never in a table), I had to add the following between the GetFromRichViewEdit and SetToRichViewEdit:
Code: Select all
NumChange := NumItemsAdded - NumItemsDeleted;
if NumChange <> 0 then begin
if SelDepth = 0 then begin { Not within a table }
SelStartNo := SelStartNo + NumChange;
SelEndNo := SelEndNo + NumChange;
end
else { Within a table }
TableItemNoArr[0] := TableItemNoArr[0] + NumChange;
end;
Thanks so much for your great support, Sergey. It's been 10 years since I purchased RichView 1.2 from you. ... and I'm still only in Beta release of my program. But I'm on a roll now and hopefully version 1 will be out before the summer.