Page 1 of 1

D2010 problem

Posted: Mon Nov 30, 2009 7:04 pm
by DickBryant
I'm trying to port very complex program to D2010 and it's not easy :-) I'm currently stuck on a RVE error called by this section of code:

if ItsAQuestion then
begin
StrPCopy(Category, GetRVDataText(MasterRVTable.Cells[PairNumber-1,0]));
MainText.Clear;
Stream := TMemoryStream.Create;
try
MasterRVTable.Cells[PairNumber-1,1].SaveRVFToStream(Stream, False, clNone, nil, nil);
Stream.Position := 0;
MainText.LoadRVFFromStream(Stream,Dummy1,Dummy2,Dummy3);
FMain.RichViewEdit2.Format;
finally
Stream.Free;
end;

This is a section of the parser that is used repeatedly to copy formatted data from a MasterRVTable cell into another RVE (MainText). The error is generated in the line:

MasterRVTable.Cells[PairNumber-1,1].SaveRVFToStream(Stream, False, clNone, nil, nil);

traced finally (during a call to RVSaveVersionInfo) to the RichView code in RVFMisc below:

procedure RVFWriteLine(Stream: TStream; s: TRVAnsiString);
begin
s := s+crlf;
Stream.WriteBuffer(PRVAnsiChar(s)^, Length(s));

s evaluates as -8131 which probably is the cause of the error. The problem is I have NO idea what the code is doing at this level of detail. The code all works OK the FIRST time this is called, but does not work on the second pass for some reason.

The code works solidly in my D7 development system.

Can you help?

Dick

Posted: Tue Dec 01, 2009 4:02 pm
by Sergey Tkachenko
The part of code for saving and loading RVF looks correct.
'-8 1 3 1' is the first line in RVF saved in D2009/D2010.

But the code
StrPCopy(Category, GetRVDataText(MasterRVTable.Cells[PairNumber-1,0]));
looks more suspicious.
- What's the type of Category, how do you allocate a memory for it? Does it have enough characters?
- Is GetRVDataText from RVGetText or RVGetTextW unit?

Posted: Tue Dec 01, 2009 4:44 pm
by DickBryant
I'll check out the Category portion of the code as you suggest. Further fooling with this shows that the quoted code will run repeatedly without issue IF similar code in the parser which parses the Answer rather than the Question is NOT run - it appears that this code somehow interferes with the next running of the code above.

I'm working on trying to figure out what the difference could be, since I THINK it's exactly the same except for referencing different cells in the MasterRVTable.

I will let you know what I find out. Thank you for your suggestion re: Category.