Recent

Author Topic: TWebBrowser control for LCL Cocoa  (Read 11102 times)

serbod

  • Full Member
  • ***
  • Posts: 138
Re: TWebBrowser control for LCL Cocoa
« Reply #15 on: November 24, 2017, 11:04:27 am »
I have problems with creating widget.
You don't need widgetset for single component. Just create TWinControl descendant and embed TActiveXContainer form LazActiveX package.

Some code and public methods descriptions can be peeked from Delphi SHDocVw.pas unit.

Also, look there - http://wiki.freepascal.org/Webbrowser
« Last Edit: November 24, 2017, 11:06:17 am by serbod »

SunyD

  • Guest
Re: TWebBrowser control for LCL Cocoa
« Reply #16 on: November 24, 2017, 04:53:05 pm »
I have problems with creating widget.
You don't need widgetset for single component. Just create TWinControl descendant and embed TActiveXContainer form LazActiveX package.

Some code and public methods descriptions can be peeked from Delphi SHDocVw.pas unit.

Also, look there - http://wiki.freepascal.org/Webbrowser
I know how to use Internet Explorer Browser as control.

This guy (phil) created TWebBrowser-Control that use Cococa-Webkit for Cocoa-Widgetset and Qt-Webkit for Qt-Widgetset.
And now I want use InternetExplroer for Win32-Widgetset. But I have problems to integrate TAxcWebBrowser in this package.
And when we integrate also gtk-webkit then we have a good webbrowser-control for all widgetsets.
I don't want create a Webbrowser-Programm. I want only use Webbrowser as a better platform independet report and print tool. Maybe as app-gui too.

SunyD

  • Guest
Re: TWebBrowser control for LCL Cocoa
« Reply #17 on: November 24, 2017, 06:00:43 pm »
I get it but I have now another problem.
I continue here http://forum.lazarus.freepascal.org/index.php/topic,39057.0.html

MISV

  • Hero Member
  • *****
  • Posts: 724
Re: TWebBrowser control for LCL Cocoa
« Reply #18 on: December 18, 2017, 12:11:42 am »
Thank you very much for this Phil!

 Will take a look soon at converting my app to trunk-Cocoa and then your browser solution


LazProgger

  • Jr. Member
  • **
  • Posts: 92
Re: TWebBrowser control for LCL Cocoa
« Reply #19 on: December 18, 2017, 06:48:29 pm »
Shouldn't it be possible to also use this control in a carbon application?

It is possible to use the CocoaAll unit in a carbon program and to mix the code of cocoa and carbon, for example to use the NS*-stuff from a carbon app.

Or are there other limitations for visual controls I am not aware of?

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: TWebBrowser control for LCL Cocoa
« Reply #20 on: December 18, 2017, 09:37:01 pm »
Shouldn't it be possible to also use this control in a carbon application?

It is possible to use the CocoaAll unit in a carbon program and to mix the code of cocoa and carbon, for example to use the NS*-stuff from a carbon app.

Or are there other limitations for visual controls I am not aware of?

On Mac, TWebBrowser depends on the LCL's Cocoa widgetset units.

LazProgger

  • Jr. Member
  • **
  • Posts: 92
Re: TWebBrowser control for LCL Cocoa
« Reply #21 on: December 18, 2017, 10:55:03 pm »
And it is not possible to only include those required units into a carbon app like it is possible for CocoaAll?

lainz

  • Hero Member
  • *****
  • Posts: 4012
  • Leandro Diaz
Re: TWebBrowser control for LCL Cocoa
« Reply #22 on: December 18, 2017, 11:43:49 pm »
Hi, I'm interested on this, instead of using Electron this can be really a good choice. Even shipping it with IE 11 for Windows, it will be good 'enough'. There are a lot of libraries out there that adds the missing things from IE with polyfills (https://polyfill.io/).

Questions:
* this supports calling from JS a pascal function?
* This supports the opposite, calling from pascal a JS function?

That stuff is available on Visual Studio, so I want (need) that also here. Else is not that usefull...
https://lainz.github.io/ - My Website :)
https://lazpaint.github.io/ -  Download LazPaint

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: TWebBrowser control for LCL Cocoa
« Reply #23 on: December 19, 2017, 01:09:46 am »
And it is not possible to only include those required units into a carbon app like it is possible for CocoaAll?

You might want to investigate what a "widgetset" is in the LCL. That's where the native controls the underlie the LCL controls are created and manipulated. You're suggesting that the units from two different widgetsets be combined in the same app. That doesn't really make much sense to me. Remember that the Cocoa WebView that TWebBrowser wraps when the Cocoa widgetset is used needs to be embedded into a parent Cocoa control. But if you're using a form with Carbon, that's not a Cocoa control underneath the form, it's a Carbon control.

Maybe you can come up with some clever hack, but your time might be spent more profitably logging bug reports and patches for the Cocoa widgetset.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: TWebBrowser control for LCL Cocoa
« Reply #24 on: December 19, 2017, 01:14:36 am »
Questions:
* this supports calling from JS a pascal function?
* This supports the opposite, calling from pascal a JS function?

With the current Cocoa and Qt4 implementations for TWebBrowser, you can evaluate JS code in your Pascal app (see readme.txt for example), but that's probably not what you need. You're probably thinking of communicating between the host Pascal code and the JS code executing in the embedded browser. That's not what I had in mind with TWebControl, but maybe you can see a way to add that. Here's what I was thinking of:

https://macpgmr.github.io/MacXPlatform/WebAppOverview_3.html

The TWebBrowser source includes an example PasMap app that is the Lazarus equivalent of the Xcode app described in the article.

lainz

  • Hero Member
  • *****
  • Posts: 4012
  • Leandro Diaz
Re: TWebBrowser control for LCL Cocoa
« Reply #25 on: December 19, 2017, 03:56:44 am »
Well it is a way of doing the 'send from pascal to the web view' with parameters on the url...

The opposite can be done, like changing the url again from the web view and reading that in Pascal. Like listening the url changes.. for example an object '{"call_js_method":"hello_world"}' can work in both directions.

Just a list of methods is required in both sides.
« Last Edit: December 19, 2017, 04:03:00 am by lainz »
https://lainz.github.io/ - My Website :)
https://lazpaint.github.io/ -  Download LazPaint

lainz

  • Hero Member
  • *****
  • Posts: 4012
  • Leandro Diaz
Re: TWebBrowser control for LCL Cocoa
« Reply #26 on: December 19, 2017, 04:31:05 am »
Another question, what's the size of the bundle using Qt?
https://lainz.github.io/ - My Website :)
https://lazpaint.github.io/ -  Download LazPaint

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: TWebBrowser control for LCL Cocoa
« Reply #27 on: December 19, 2017, 04:33:17 am »
Another question, what's the size of the bundle using Qt?

I never got Qt4 working with Mac. Qt5 widgetset does not include support for Qt5's Web browser control.

The QtWebView.framework (64 bit) is the whopper in the bunch, with a 32MB footprint. QtGui.framework is next at 13.5 MB. The rest are fairly modest in size.

Microsoft's Remote Desktop app on Mac uses Qt4, but it only includes the Qt4 libs it needs (Core, Gui, Network, Xml). QGIS on Mac also uses Qt4 and includes all of the Qt frameworks, but since the QGIS.app footprint is 640MB, QtWebView's 32MB is only, what, 5% of the app footprint and so doesn't add much weight.
« Last Edit: December 19, 2017, 04:50:30 am by Phil »

lainz

  • Hero Member
  • *****
  • Posts: 4012
  • Leandro Diaz
Re: TWebBrowser control for LCL Cocoa
« Reply #28 on: December 19, 2017, 04:57:32 am »
And of course sure is better than IE11 that's shipped with Windows, in features, I wish.
https://lainz.github.io/ - My Website :)
https://lazpaint.github.io/ -  Download LazPaint

 

TinyPortal © 2005-2018