[Lazarus] How to display html contents?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] How to display html contents?

Giuliano Colla
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

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

leledumbo
Administrator
> 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
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
Il 06/05/2015 14:48, leledumbo ha scritto:
>> 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
>

Thanks a lot,

Giuliano


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Martin-2
In reply to this post by Giuliano Colla
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


On 06/05/15 09:37, Giuliano Colla wrote:

> 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
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Euller Pereira
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 <[hidden email]>:
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


On 06/05/15 09:37, Giuliano Colla wrote:
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



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
Il 08/05/2015 22:23, Euller Pereira ha scritto:
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 <[hidden email]>:
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.


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
 

-- 
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
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

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
In reply to this post by Giuliano Colla
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:

http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Help-turbopower-ipro-anchors-td4041182.html#none

Giuliano

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Martin-2
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

On 09/05/15 10:47, Giuliano Colla wrote:

> 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:
>
> http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Help-turbopower-ipro-anchors-td4041182.html#none 
>
>
> Giuliano
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Martin-2
In reply to this post by Giuliano Colla
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


On 09/05/15 10:47, Giuliano Colla wrote:

> 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:
>
> http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Help-turbopower-ipro-anchors-td4041182.html#none 
>
>
> Giuliano
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

vfclists .
In reply to this post by Giuliano Colla


On 6 May 2015 at 09:37, Giuliano Colla <[hidden email]> wrote:
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

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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..

--
Frank Church

=======================
http://devblog.brahmancreations.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
In reply to this post by Martin-2
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

--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
In reply to this post by vfclists .
Il 09/05/2015 21:17, vfclists . ha scritto:
> 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.

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


--
Giuliano Colla

Project planning question: when it's 90% done, are we halfway or not yet?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Martin-2
In reply to this post by Giuliano Colla
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.

On 10/05/15 11:15, Giuliano Colla wrote:

> 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
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

dmitry boyarintsev
In reply to this post by Giuliano Colla
On Sun, May 10, 2015 at 6:21 AM, Giuliano Colla <[hidden email]> wrote:.
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.

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
 

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Michael Schnell
In reply to this post by Giuliano Colla
On 05/06/2015 10:37 AM, Giuliano Colla wrote:
>
> I 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to display html contents?

Giuliano Colla
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.



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus