Open GoogleCodeExporter opened 9 years ago
Hi xyz,
it would be easier to answer if I had a copy of c:\temp\sample.html.
HtmlViewer.NameList:ThtStringList (which references its document's
IDNameList:TIDObjectList) collects ID attributes of all tags and name
attributes of A tags. The strings contain the uppercased ID resp. NAME and the
corresponding object is a TIdObject derivate.
OrphanCat
Original comment by OrphanCat
on 7 Sep 2012 at 5:00
Hi xyz,
thanks for the sample.html.
With this procedure:
procedure TFormLiveHtml.NameList1Click(Sender: TObject);
var
Infos: TStringList;
Names: TIDObjectList;
I: Integer;
begin
// simply get the names
//Clipboard.AsText := HtmlViewer.NameList.Text;
// get the names and the actual types of the associated TIDObject derivates.
Infos := TStringList.Create;
try
Names := HtmlViewer.SectionList.IDNameList;
for I := 0 to Names.Count - 1 do
Infos.Add(Names.Strings[I] + ' (' + Names.Objects[I].ClassName + ')');
Clipboard.AsText := Infos.Text;
finally
Infos.Free;
end;
end;
I'm getting this result from the ClipBoard:
0 (TChPosObj)
1 (TChPosObj)
10 (TChPosObj)
11 (TChPosObj)
12 (TChPosObj)
13 (TChPosObj)
14 (TChPosObj)
15 (TChPosObj)
16 (TChPosObj)
17 (TChPosObj)
18 (TChPosObj)
19 (TChPosObj)
2 (TChPosObj)
20 (TChPosObj)
21 (TChPosObj)
22 (TChPosObj)
23 (TChPosObj)
24 (TChPosObj)
25 (TChPosObj)
26 (TChPosObj)
27 (TChPosObj)
28 (TChPosObj)
29 (TChPosObj)
3 (TChPosObj)
30 (TChPosObj)
31 (TChPosObj)
32 (TChPosObj)
33 (TChPosObj)
34 (TChPosObj)
35 (TChPosObj)
36 (TChPosObj)
37 (TChPosObj)
38 (TChPosObj)
39 (TChPosObj)
4 (TChPosObj)
40 (TChPosObj)
41 (TChPosObj)
42 (TChPosObj)
43 (TChPosObj)
44 (TChPosObj)
45 (TChPosObj)
451 (TChPosObj)
453 (TChPosObj)
46 (TChPosObj)
466 (TChPosObj)
6 (TChPosObj)
65 (TChPosObj)
7 (TChPosObj)
8 (TChPosObj)
9 (TChPosObj)
ABUZZ (TChPosObj)
AZANS (TChPosObj)
ZERO (TChPosObj)
ZOON (TChPosObj)
which seems to be okay.
OrphanCat
Original comment by OrphanCat
on 12 Sep 2012 at 8:55
OrphanCat,
Thank you for providing an example of how to access the NameList properties of
the contents of THTMLViewer. What I really would like to learn is how to
obtain the properties of NameList items in the current THTMLViewer VIEW window.
I need to be able to determine the range of items within the current view, not
the entire document.
Original comment by xyz.123....@gmail.com
on 15 Sep 2012 at 12:38
Hi,
you might be interested in ThtDocument.PositionList resp.
ThtDocument.FindSectionAtPosition(). PositionList is a TList containing objects
based on TSectionBase. It is used in FindSectionAtPosition() to find the last
section starting at or above a given YPosition.
For example:
SectionFrom := HtmlViewer.SectionList.FindSectionAtPosition(
HtmlViewer.VScrollBar.Position,
SectionYPosition1, SectionIndexInPositionList1);
SectionTo := HtmlViewer.SectionList.FindSectionAtPosition(
HtmlViewer.VScrollBar.Position + HtmlViewer.PaintPanel.Height - 1,
SectionYPosition2, SectionIndexInPositionList2);
gets first and last section within the view.
Most probably this is still not the whole story you need, but it might get you
closer to it...
As to the empty NameList: is this issue been solved?
OrphanCat
Original comment by OrphanCat
on 11 Oct 2012 at 9:24
>> As to the empty NameList: is this issue been solved?
Yes, it has. Thank you.
Original comment by xyz.123....@gmail.com
on 13 Oct 2012 at 1:52
>> For example:
>> SectionFrom := ...
>> gets first and last section within the view.
Thanks, but unfortunately your code snippet isn't sufficient for me to figure
out how to implement the example.
Original comment by xyz.123....@gmail.com
on 13 Oct 2012 at 1:59
Original comment by OrphanCat
on 26 Apr 2014 at 10:12
Original issue reported on code.google.com by
xyz.123....@gmail.com
on 6 Sep 2012 at 3:43