Embedding Web Browser in Lazarus app lazarus / 31-LCL ---------------------------------------------------------------------- mariantb87 · 2011-07-01 22:17 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 · 2011-07-01 23:21 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? ---------------------------------------------------------------------- Phil · 2011-07-02 00:47 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 · 2011-07-02 08:19 I tried on Windows and Linux and I get the same error: ERROR: Too many calls for GeckoComponentsShutdown then GeckoComponentsStartup ---------------------------------------------------------------------- Dibo · 2011-07-02 13:42 Quote from: Phil on July 02, 2011, 02:47:07 amOf 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 · 2011-07-05 13:09 Quote from: mariantb87 on July 02, 2011, 12:17:54 amI 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 · 2011-07-05 15:15 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 · 2011-07-05 16:23 I updated lazarus source. Now I can compile and run projekt with THTMLPort, but sill does not look good at design time ---------------------------------------------------------------------- Phil · 2011-07-05 16:30 Quote from: Dibo on July 05, 2011, 06:23:46 pmI 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 · 2011-07-06 18:09 I can't test it on stable version now, but I attached screen here ---------------------------------------------------------------------- Phil · 2011-07-06 18:21 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 · 2011-07-06 19:08 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 · 2011-07-06 19:10 Form designer bugs can be logged as usual. THtmlPort bugs you can select packages or something in Mantis. Thanks. -Phil ---------------------------------------------------------------------- Dibo · 2011-07-06 19:18 Quote from: Phil on July 06, 2011, 09:10:08 pmForm designer bugs can be logged as usual I'm mean, should I attach some output debug log (how) ? ---------------------------------------------------------------------- Phil · 2011-07-06 19:23 Quote from: Dibo on July 06, 2011, 09:18:50 pmQuote from: Phil on July 06, 2011, 09:10:08 pmForm 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