Problem with invalid HTMLLinks in Tables(HtmlViewerimporter)

General TRichView support forum. Please post your questions here
Post Reply
Memnarch
Posts: 24
Joined: Mon Jul 08, 2013 7:21 am

Problem with invalid HTMLLinks in Tables(HtmlViewerimporter)

Post by Memnarch »

Okay,
this thread continues a problem i encountered and started here:
http://www.trichview.com/forums/viewtopic.php?t=6226

The real problem is within the HTML. If a link is within a table, it will not work with OnJump. The given JumpID will return an invalid ItemNo.

example html:

Code: Select all

<html>
	<head>
	</head>
	<body>
		<table>
			<tr>
				<td>
					<a href="http://www.google.de">www.google.de</a>
				</td>
			</tr>
		</table>
	</body>
</html>
What i do:
Load it into THTMLViewer and import it with the THTMLViewerImporter into the RichView. The resulting document looks good, but clicking on a link will not work.
(at the same time, i use URLScan.pas after loading the document)

Someone has a clue why OnJump does not work in this case?

Greetings
Memnarch
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I think the problem is in a code you use in OnJump.

The example of a correct code:

Code: Select all

procedure TfrmMain.rveJump(Sender: TObject; id: Integer);
var ItemNo: Integer;
    RVData: TCustomRVFormattedData;
    s: String;
begin
  rve.GetJumpPointLocation(id, RVData, ItemNo);
  s := RVData.GetItemTag(ItemNo);
  ShellExecute(0, 'open', PChar(s), nil, nil, SW_SHOW);
end;
Common mistakes:
1) using GetJumpPointItemNo instead of GetJumpPointLocation. GetJumpPointItemNo is obsolete and cannot be used in tables.
or
2) calling GetJumpPointLocation, but then using only ItemNo instead of using the both RVData and ItemNo:

Code: Select all

procedure TfrmMain.rveJump(Sender: TObject; id: Integer);
var ItemNo: Integer;
    RVData: TCustomRVFormattedData;
    s: String;
begin
  rve.GetJumpPointLocation(id, RVData, ItemNo);
  s := [color=red]rv[/color].GetItemTag(ItemNo); [color=red]// ERROR - does not work in tables![/color]
  ShellExecute(0, 'open', PChar(s), nil, nil, SW_SHOW);
end;
Memnarch
Posts: 24
Joined: Mon Jul 08, 2013 7:21 am

Post by Memnarch »

thank you very much, this did the trick.

YOu might consider declaring GetJumpPointItemNo as deprecated with a given message which hints to GetJumpPointLocation? :)

Greetings
Memnarch
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Ok, done.
Memnarch
Posts: 24
Joined: Mon Jul 08, 2013 7:21 am

Post by Memnarch »

Thank you :)
Post Reply