Hi all,
I need to display some local html files in a Lazarus application, which must run under Linux.
What's the best way to go?
Thanks in advance for any hint.
Giuliano

Mailing lists / lazarus / 2015-05
18 messages · 7 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi all,
I need to display some local html files in a Lazarus application, which must run under Linux.
What's the best way to go?
Thanks in advance for any hint.
Giuliano
I need to display some local html files in a Lazarus application, which
must run under Linux.
* http://wiki.lazarus.freepascal.org/THtmlPort
*
http://wiki.lazarus.freepascal.org/Webbrowser#Using_the_Turbopower_internet_pro_control
Il 06/05/2015 14:48, leledumbo ha scritto:
Thanks a lot,
Giuliano
I need to display some local html files in a Lazarus application, which must run under…
This tutorial below will get you up and running quickly with turbopower ipro html component.
http://pp4s.co.uk/main/tu-form2-help-demo-laz.html
You'll be able to see how to handle images and hot clicks easily.
A PDF manual is available at the link below, but only a small part of the functionality detailed has been ported to lazarus.
http://download.sourceforge.net/tpipro/tpipro_docs.zip
Ipro is slightly buggy but I've managed to get it displaying what I want quite well (with some workarounds).
Rgds,
Martin
There's a framework called Brook and a plug-in for it called JTemplate, it's totally written in pascal and may be what you are looking for. Here's the link: http://silvioprog.github.io/brookframework/
2015-05-08 16:55 GMT-03:00 Martin :
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150508/97c06a8a/attachment.html>
Il 08/05/2015 22:23, Euller Pereira ha scritto:
Many thanks to both of you. With TIPHtmlPanel (which uses turbopower ipro) I've been able to display my contents. The only problem I get is that while links to other pages do work properly, a link to a tag in the same page doesn't work, even if the tag is properly recognized (I get a hint with the tag name passing with the mouse over the link). Is it a known issue or I'm doing something wrong?
Giuliano
Il 09/05/2015 00:02, Giuliano Colla ha scritto:
a link to a tag in the same page doesn't work,
I meant to an anchor. Sorry.
Giuliano
Il 08/05/2015 22:23, Euller Pereira ha scritto: Many thanks to both of you. With…
Il 09/05/2015 00:02, Giuliano Colla ha scritto:
Is it a known issue or I'm doing something wrong?
By browsing the list I discovered it's a known issue:
Giuliano
Hi,
That was me asking the ipro question in the link below. I got it work but in my excitement forgot to update the mailing list with my progress! Sorry.
To get an anchor link to show correctly (e.g.
somefile.html#readthisbit), I discovered you need to do the following - note the magic moment is at step 3.
1. Split the url/anchor and remove the # from the anchor value.
2. Pass the url only to your open html procedure.
3. Call Application.ProcessMessages;
4. Call .Scroll(hsaEnd) on the html panel
5. Call .MakeAnchorVisible(anchor value without #) on the html panel.
I am guessing that without Application.ProcessMessages; the code is trying to call MakeAnchorVisible before the opening of the html has completed and the anchor doesn't yet exist?? I am no expert on the inner workings although I have been looking at the source and understanding only very small parts of it.
I hope this helps? I am utterly astounded that I may have just helped someone for a change instead of it being me asking for help!! :-)
Rgds,
Martin Collins
Il 09/05/2015 00:02, Giuliano Colla ha scritto: By browsing the list I discovered it's a…
I should also let you know of something else I found out only recently about turbopoweripro - there are printing methods that are not exposed by default. They were quite clearly always there in the examples folder provided with lazarus svn and I should have looked before!
Go to Project > Project Options and click on Additions & Overrides. Add a Custom Option and enter "-dHtml_Print" (without quotes).
The example project shows to add these lines to your code:
under unit name -
{$define UsePreview}in uses section -
{$ifdef UsePreview}
OsPrinters,
{$endif}You now have access to new methods on the htmlpanel, e.g.
.PrintPreview;
.GetPrintPageCount;
.Print(1, PageCnt);I have been playing with these but have discovered a known bug. When printing a file that spans multiple pages, the last line of any page is repeated as the first line of the next page.
If I find a workaround (or maybe even fix the source code - HA!), I will let you know.
Rgds,
Martin Collins
I need to display some local html files in a Lazarus application, which must run under…
If you are on Linux and you are okay with Qt you might consider the QT webkit demo.
It will probably make things way easier for you. It might prove a nice way to learn out to use the Qt 4.8.x series directly.
I tried the Internet Pro control first but realized that it would be more difficult in the long term. If you are bold enough you might be able to make it into a component.
It is available at http://users.telenet.be/Jan.Van.hijfte/qtforfpc/ file name lclwebkit.zip
I just noticed http://sourceforge.net/projects/lazwebkit/ which is GTK2 compatible bit I haven't tried it yet..
That was me asking the ipro question in the link below. I got it work but in my…
Il 09/05/2015 20:40, Martin ha scritto:
To get an anchor link to show correctly (e.g. somefile.html#readthisbit), I discovered you need to do the following - note the magic moment is at step 3.
Thanks a lot for the tip.
Unfortunately what I need is to provide a link to anchors on the same page. Meaning that I should implement something of the sort you suggest within the ipro code, provided I find my way in the sources....
You gave me a clue, I'll try to take advantage of it.
Giuliano
If you are on Linux and you are okay with Qt you might consider the QT webkit demo. It…
Il 09/05/2015 21:17, vfclists . ha scritto:
Actually I'm porting to Lazarus a collection of Kylix applications, which where using a TTextViewer component, which is nothing but a wrapper for QTextViewer. Kylix used Qt3, but I see that the same component also exists in QT4. If I don't manage to fix ipro for my purposes, what you propose is another viable option, leading to a Lazarus TTextViewer.
Thank you very much for the tip.
Giuliano
Il 09/05/2015 20:40, Martin ha scritto: Thanks a lot for the tip. Unfortunately what I…
Anchors on the same page are no problem. You could still do the steps 1 to 5 below and whether the anchor is on the same page or not it would work. However step 2 would be a waste of processing power if the anchor is already on the same page, in that case just omit steps 2 and 3.
1. Split the url/anchor and remove the # from the anchor value.
2. Pass the url only to your open html procedure.
3. Call Application.ProcessMessages;
4. Call .Scroll(hsaEnd) on the html panel
5. Call .MakeAnchorVisible(anchor value without #) on the html panel.
Il 09/05/2015 21:17, vfclists . ha scritto: Actually I'm porting to Lazarus a collection…
On Sun, May 10, 2015 at 6:21 AM, Giuliano Colla <
If you're planning to use Qt only, you can go as low as following: Get a handle of TMemo and call Qt function QTextEdit_setHtml (declared at qt45.pas).
Something like this:
uses
... qt4, qtwidgets, qtprivate..
...
var
html : string; // assuming this is utf8 html
w : widestring;
...
whtml:=UTF8Decode(html);
QTextEdit_setHtml( TQtTextEdit( (Memo1.Handle).widget, PWideString(w));thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150510/6c233d8a/attachment-0001.html>
Il 11/05/2015 04:50, Dmitry Boyarintsev ha scritto:
If you're planning to use Qt only, you can go as low as following:
Yes I'm on a Qt only solution. I'll try your suggestion ASAP.
Thank you very much, or better, ??????? ???????,
Giuliano
I need to display some local html files in a Lazarus application, which must run under…
Giuliano Colla wroteI need to display some local html files in a Lazarus application, which must run under Linux.
Maybe start a Browser with the file spec as parameter.
-Michael
Il 11/05/2015 16:02, Michael Schnell ha scritto:
Maybe start a Browser with the file spec as parameter.
You're right, that would be the easiest path.
But I happen to need an integrated help in an industrial environment: just a window with the appropriate information, a large "close" button (the human interface is a touch screen), and nothing else.
However both the Qt widgets proposed by Dmitry, and the lclwebkit suggested by Frank appear to provide more or less what I need. Just a bit of extra ironing to adapt to my needs.
Giuliano.