Page 1 of 1

Problem with invalid HTMLLinks in Tables(HtmlViewerimporter)

Posted: Tue Dec 10, 2013 4:36 pm
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

Posted: Tue Dec 10, 2013 6:32 pm
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;

Posted: Wed Dec 11, 2013 8:28 am
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

Posted: Wed Dec 11, 2013 8:40 am
by Sergey Tkachenko
Ok, done.

Posted: Wed Dec 11, 2013 4:28 pm
by Memnarch
Thank you :)