Page 1 of 1

Hypertext works in TRichViewEdit and crashes in TRichView

Posted: Thu Feb 13, 2014 8:13 pm
by Jim Knopf
I integrated hyperlinks as shown in the demo 'create hyperlinks'. Works fine there in the TRichViewEdit. If I load the same text inti TRichView, I get an access violation in CRVData because he never gets a valid item (here:
if GetItem(i).GetBoolValueEx(rvbpJump, RVStyle))

Code: Select all

procedure TCustomRVFormattedData.GetJumpPointLocation(id: Integer;
  var RVData: TCustomRVFormattedData; var ItemNo: Integer);
var i: Integer;
    LRVData: TCustomRVData;
    RVStyle: TRVStyle;
    StoreSub: TRVStoreSubRVData;
    item: TCustomRVItemInfo;
begin
  RVStyle := GetRVStyle;
  RVData := nil;
  ItemNo := -1;
  for i := 0 to ItemCount-1 do begin
    if GetItem(i).GetBoolValueEx(rvbpJump, RVStyle) and
       (GetItem(i).JumpID+FirstJumpNo = id) then begin
      RVData := Self;
      ItemNo := i;
      exit;
    end;
    item := GetItem(i);
    LRVData := TCustomRVData(item.GetSubRVData(StoreSub, rvdFirst));
    if (LRVData<>nil) then begin
       repeat
         if LRVData.GetRVData is TCustomRVFormattedData then
           TCustomRVFormattedData(LRVData.GetRVData).GetJumpPointLocation(id, RVData, ItemNo);
         if RVData<>nil then begin
           StoreSub.Free;
           exit;
         end;
         LRVData := TCustomRVData(item.GetSubRVData(StoreSub, rvdNext));
       until LRVData=nil;
     end;
     StoreSub.Free;
   end;
end;
In TRichViewEdit are about 56 items, in TRichView only 23. In TRichViewEdit the result is true at the 13th item, in TRichView never. Regardless of UseHypertextStyles in RTFReadProperties is set or not.

Do you have any idea what's going wrong?

Posted: Thu Feb 13, 2014 8:54 pm
by Sergey Tkachenko
Can you send a project reproducing this error to richviewgmailcom?

Posted: Thu Feb 13, 2014 10:10 pm
by Jim Knopf
Sent you a first shot by mail

Posted: Sat Feb 15, 2014 7:27 pm
by Jim Knopf
Sorry, my mistake: I used two different TRichViewEdits in declaration and code ...