[Lazarus] Help - turbopower ipro - anchors
mailinglists at collins-email.co.uk
Sat Mar 14 09:02:14 CET 2015
Sorry to post for help, it's my last resort! If anyone has any
experience with turbopower_ipro, I would be very grateful if you could
give me a little help please?
I've been knocking something up using similar code found in
examples/turbopower_ipro/mainunit.pas for a bunch of local html documents.
I am using the OpenHTMLFile(const Filename : string) procedure (from the
examples folder), and this fails unless it is an html file. It doesn't
take anchor values. So I intercept the hotlinks and call
MakeAnchorVisible(Anchor) on the htmlpanel if it is an anchor (but found
finally after the reading the source code that I had to remove the
leading # first), or OpenHTMLFile if it is a document. All good so far.
Showing anchors work if they relate to the same html document currently
loaded (e.g. link = '#section02'), as I only call MakeAnchorVisible**
and not OpenHTMLFile. If a HotLink points to another document and an
anchor at the same time, e.g. something like 'doc-002.htm#section03'
then I have a problem. I split the url, load the html document and then
call MakeAnchorVisible on the trailing anchor value.
The problem is the page loads but the anchor does not show.
MakeAnchorVisible seems to do nothing, the top of the html is shown at
the top of the panel, which is what OpenHTMLFile does. I have tried all
sorts of weird and wonderful things to get this to work. All to no avail.
I am guessing that I am calling MakeAnchorVisible before the htmlpanel
has finished parsing all the nodes in the displayed html, so it does not
know where that anchor is and does nothing??? I can't seem to find a
suitable event (e.g. IHaveFinishedLoadingAndParsingHTML!) to call
As usual sitting here on my lonesome, wearing my "Total Noob" hat, I am
probably going about things completely the wrong way and have approached
this wrong from the beginning. Kick me if necessary :-)
Will take a little break I think and come back to this tomorrow (Sunday)
as my brain is frizzled!
Thanks in advance.
**Actually the start of the anchor shows at the bottom of the htmlpanel,
which is not what you would want. I fixed this by calling Scroll(hsaEnd)
on the panel first, which scrolls the panel to the end of the html
document, before calling MakeAnchorVisible. This way the anchor shows at
the top of the htmlpanel and you can read the section without scrolling.
More information about the Lazarus