Recent

Author Topic: Embedding Web Browser in Lazarus app  (Read 21090 times)

mariantb87

  • Guest
Embedding Web Browser in Lazarus app
« on: July 02, 2011, 12:17:54 am »
I need help embedding an web browser into lazarus app.
Does anyone tried to use Gecko or Webkit ? I tried but I had no success at all.

I tried Gecko port from:
http://wiki.lazarus.freepascal.org/GeckoPort


Please help me.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Embedding Web Browser in Lazarus app
« Reply #1 on: July 02, 2011, 01:21:03 am »
Once I tried it but I also had no success because I use Linux+Qt which is not supported. IIRC it supports Win, GTK2 and maybe Carbon.
What platform you are and what error messages it gives?
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Embedding Web Browser in Lazarus app
« Reply #2 on: July 02, 2011, 02:47:07 am »
No, Carbon does not work with Gecko, as the wiki indicates.

I had no interest in Qt when I ported Gecko so I didn't even try to support it and it doesn't appear as though the current maintainer, José, has any interest in Qt either. However, you're certainly welcome to try to add support for Qt. Take a look at GeckoBrowser.pas in the GetNativeWindow method - in only takes a few lines of code to add support, provided you can supply what Gecko expects.

That is, Gecko wants a handle to a native window. I'm not sure what that means in the context of Qt, which is already a wrapper around an underlying native GUI that differs by platform.

Of course, Qt includes WebKit, which might be a better choice than Gecko considering how big WebKit is becoming these days, with 90% of mobile device browsing being done with a WebKit-based browser (on iPad, iPhone, Android, Blackberry). Of course, you'd first have to wrap WebKit in an LCL control...  In Xcode, you just drop a Web View onto your window.

Thanks.

-Phil

mariantb87

  • Guest
Re: Embedding Web Browser in Lazarus app
« Reply #3 on: July 02, 2011, 10:19:23 am »
I tried on Windows and Linux and I get the same error:
ERROR: Too many calls for GeckoComponentsShutdown then GeckoComponentsStartup

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Embedding Web Browser in Lazarus app
« Reply #4 on: July 02, 2011, 03:42:38 pm »
Of course, Qt includes WebKit, which might be a better choice than Gecko considering how big WebKit is becoming these days, with 90% of mobile device browsing being done with a WebKit-based browser (on iPad, iPhone, Android, Blackberry). Of course, you'd first have to wrap WebKit in an LCL control...  In Xcode, you just drop a Web View onto your window.
I have technical question. Is anyone know that is it possible to embed WebKit on GTK/win32 application? I'm mean, for now if I want use WebKit I must rebuild whole LCL to QT widgetset and distribute my program with all QT librarys. Exists any way to create non-QT application which use only libwebkit for embed browser window?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Embedding Web Browser in Lazarus app
« Reply #5 on: July 05, 2011, 03:09:43 pm »
I need help embedding an web browser into lazarus app.
Does anyone tried to use Gecko or Webkit ? I tried but I had no success at all.

You could try THtmlPort: http://wiki.lazarus.freepascal.org/THtmlPort

It isn't fancy like WebKit nor Gecko, but it can display correctly most simple html.

It works very well in Carbon and I wrote a simple browser based on it: http://wiki.lazarus.freepascal.org/fpbrowser

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Embedding Web Browser in Lazarus app
« Reply #6 on: July 05, 2011, 05:15:41 pm »
I tried test THTMLPort today. I downloaded source from svn trunk. Compilation and installation went ok. But when I try to run empty project (or demo) with THTMPort, lazarus hangs on compiling and consume 100% CPU. I waited few minutes and kill lazarus process. This component looks corrupted at design time too (some strange artifacts and no borders).
I have ubuntu 11.04 64 bit, Unity GTK2
Lazarus 0.9.31 from SVN, revision  31494
FPC 2.5.1 from SVN. revision 110702

Anyone can confirm this?

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Embedding Web Browser in Lazarus app
« Reply #7 on: July 05, 2011, 06:23:46 pm »
I updated lazarus source. Now I can compile and run projekt with THTMLPort, but sill does not look good at design time

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Embedding Web Browser in Lazarus app
« Reply #8 on: July 05, 2011, 06:30:46 pm »
I updated lazarus source. Now I can compile and run projekt with THTMLPort, but sill does not look good at design time

Test with 0.9.30 and see if any better. If so, then post a bug report for Lazarus IDE.

Screenshot would be useful too - have no idea how it "doesn't look good".

Thanks.

-Phil

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Embedding Web Browser in Lazarus app
« Reply #9 on: July 06, 2011, 08:09:40 pm »
I can't test it on stable version now, but I attached screen here

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Embedding Web Browser in Lazarus app
« Reply #10 on: July 06, 2011, 08:21:23 pm »
I would guess that's a form designer bug. It looks a little like what you see on Windows, but I've never seen it anywhere else. Does it only occur with THtmlViewer and not with TFrameViewer or TFrameBrowser?

The wiki indicates that changing the control's BorderStyle eliminates this artifact in the designer, but that doesn't seem to do anything now on Windows.  Meaning something else has changed in the form designer.

You might log a bug report for the Lazarus IDE since this is easy to reproduce.

Thanks.

-Phil

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Embedding Web Browser in Lazarus app
« Reply #11 on: July 06, 2011, 09:08:02 pm »
BorderStyle does not changing anything but TFrameViewer and TFrameBrowser looks fine. How can I create log for design bug?

BTW: Should I report bug with missing selected text background? I know that this is GTK behavior (no implementation for this) but maybe nobody know about this?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Embedding Web Browser in Lazarus app
« Reply #12 on: July 06, 2011, 09:10:08 pm »
Form designer bugs can be logged as usual. THtmlPort bugs you can select packages or something in Mantis.

Thanks.

-Phil

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: Embedding Web Browser in Lazarus app
« Reply #13 on: July 06, 2011, 09:18:50 pm »
Form designer bugs can be logged as usual
I'm mean, should I attach some output debug log (how) ?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Embedding Web Browser in Lazarus app
« Reply #14 on: July 06, 2011, 09:23:38 pm »
Form designer bugs can be logged as usual
I'm mean, should I attach some output debug log (how) ?

The key to a bug report is to supply the right information so it's easily reproducible. In this case, I would think that something like this should be sufficient:

- Compile and add THtmlPort package to Laz IDE.
- Drop THtmlViewer on form and look at odd design artifacts.

Thanks.

-Phil

 

TinyPortal © 2005-2018