Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

WebView4Delphi updates

User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

WebView4Delphi updates

Post by salvadordf »

The first version of WebView4Delphi has been released! :D

WebView4Delphi allows you to embed Chromium based web browsers in your Delphi or Lazarus applications using the WebView2 runtime.

WebView4Delphi uses the Microsoft Edge WebView2 Runtime and Microsoft.Web.WebView2 NuGet package to embed a web browser.

Before you try WebView4Delphi you have to download the Microsoft Edge WebView2 Runtime from here :
https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section

If you install the evergreen version of the runtime it will be updated automatically with Windows Update but you can also decompress the fixed version in your computer and configure WebView4Delphi to use it.

WebView4Delphi also uses the latest stable version of the WebView2 nuget package 1.0.1054.31 found here :
https://www.nuget.org/packages/Microsoft.Web.WebView2

All the demos use the WebView2Loader.dll file included in the Microsoft.Web.WebView2 NuGet package. A copy of WebView2Loader.dll can be found in the bin32 and bin64 directories.

All the demos are configured to use the evergreen version of the runtime and the executable is created inside the bin32 and bin64 directories.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

The last WebView4Delphi update included these changes :
  • Added the KioskBrowser demo.
  • Added TWVBrowserBase.OnWidget0CompMsg, TWVBrowserBase.OnWidget1CompMsg, TWVBrowserBase.OnRenderCompMsg and TWVBrowserBase.OnD3DWindowCompMsg to intercept Windows messages.
  • Added an additional registry check in TWVLoader to detect if the WebView2 runtime is installed.
  • Added a custom TPopupMenu thanks to Alessandro Mancini. :D
  • Navigate to "about:blank" in TWVBrowser if the user doesn't specify a default URL.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

Due to initialization problems in some applications I've reverted the default TWVBrowser.DefaultURL value to an empty string.

Please, download WebView4Delphi again from GitHub.

I'm sorry for the problems caused.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

This is what's new in the last WebView4Delphi update :
  • Added the EditorBrowser demo.
  • Fixed build issue in Lazarus.
  • Lazarus demos : Fixed string conversion in showmessage calls
  • Added TWVBrowser.RetrieveHTML
  • Added TWVBrowser.RetrieveText
  • Added TWVBrowser.OnPrintCompleted
  • Added TWVBrowser.OnRetrieveHTMLCompleted
  • Added TWVBrowser.OnRetrieveTextCompleted
The TWVBrowser.RetrieveHTML call will trigger the TWVBrowser.OnRetrieveHTMLCompleted event with the HTML.
The TWVBrowser.RetrieveText call will trigger the TWVBrowser.OnRetrieveTextCompleted event with the document's text.
The TWVBrowser.Print call will trigger the TWVBrowser.OnPrintCompleted event when it finishes printing.

All those functions use JavaScript code due to the WebView2 limitations and I had to add some constants to identify the JavaScript results in TWVBrowser.OnExecuteScriptCompleted

RetrieveHTML, RetrieveText and Print call TWVBrowser.ExecuteScript with these reserved "aExecutionID" values that I added to uWVConstants :
  • WEBVIEW4DELPHI_JS_PRINTJOB_ID
  • WEBVIEW4DELPHI_JS_RETRIEVEHTMLJOB_ID
  • WEBVIEW4DELPHI_JS_RETRIEVETEXTJOB_ID
TWVBrowser.RetrieveHTML is based in the code created by Alessandro Mancini. Thank you! :D
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

This is what's new in WebView4Delphi since the last announcement :
  • KioskBrowser demo: Replaced JS code with a simple property to disable the context menu.
  • MiniBrowser demo : Added a menu option to change the User Agent string.
  • Added missing dependency used by older Delphi versions.
  • Added TWVBrowser.IsNavigating
  • Added TWVBrowser.RetrieveMHTML
  • Added TWVBrowser.OnRetrieveMHTMLCompleted
  • Reserved an execution id value range for internal use by some DevTools method calls.
  • MiniBrowser demo : Condensed all load and save functions in 2 menu items with several dialog filters.
  • MiniBrowser demo : Added MHTML support in the new open and save dialog filter options.
  • Added TWVBrowserBase.OnClearCacheCompleted
  • Added TWVBrowserBase.OnClearDataForOriginCompleted
  • Added TWVBrowserBase.OnOfflineCompleted
  • Added TWVBrowserBase.OnIgnoreCertificateErrorsCompleted
  • Expose ICoreWebView2CompositionController methods and properties in TWVBrowserBase too
  • Added TWVBrowser.RefreshIgnoreCache
  • Added TWVBrowser.OnRefreshIgnoreCacheCompleted
  • Added new popup windows and new tab support to the TabbedBrowser demos.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

The latest WebView4Delphi update included these changes :
  • Added a aResourceID parameter to the TWVBrowserBase.OnWebResourceResponseViewGetContentCompleted event.
  • Renamed TWVBrowserBase.doIgnoreCertificateErrorsCompleted to TWVBrowserBase.doOnIgnoreCertificateErrorsCompleted.
The new aResourceID parameter allows you to keep track of which content request made with a TCoreWebView2WebResourceResponseView.GetContent call triggered the TWVBrowserBase.OnWebResourceResponseViewGetContentCompleted event.

If you try to get the response content of a request then you can use the TWVBrowserBase.OnWebResourceResponseReceived event to get the ICoreWebView2WebResourceResponseReceivedEventArgs instance which allows you to create a TCoreWebView2WebResourceResponseView instance.
Then you can create a TCoreWebView2WebResourceResponseViewGetContentCompletedHandler instance and call TCoreWebView2WebResourceResponseView.GetContent.
The TWVBrowserBase.OnWebResourceResponseViewGetContentCompleted will be triggered with the contents and the same "aResourceID" given when you created the TCoreWebView2WebResourceResponseViewGetContentCompletedHandler instance. This allows you to identify the resource and to free all the classes related to this request.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

These are the changes since the last announcement :
  • Added GlobalWebView2Loader.RemoteDebuggingPort
  • Added TWVBRowserBase.SimulateKeyEvent
  • Added TWVBRowserBase.KeyboardShortcutSearch
  • Added TWVBRowserBase.KeyboardShortcutRefreshIgnoreCache
  • Added TWVBRowserBase.OnSimulateKeyEventCompleted
  • Added JSONEscape in uWVMiscFunctions
  • Fixed JSONUnescape declaration
  • Added TWVBrowserBase.RenderCompHWND
  • Added TWVBrowserBase.Widget0CompHWND
  • Added TWVBrowserBase.Widget1CompHWND
  • Added TWVBrowserBase.D3DWindowCompHWND
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Update to WebView2 NuGet 1.0.1072.54

Post by salvadordf »

Hi,

WebView4Delphi has been updated to WebView2 NuGet 1.0.1072.54

This is what's new :
  • Added the TWVBrowserBase.OnIsMutedChanged event.
  • Added the TWVBrowserBase.OnIsDocumentPlayingAudioChanged event.
  • Added the TWVBrowserBase.OnIsDefaultDownloadDialogOpenChanged event.
  • Added the TWVBrowserBase.ToggleMuteState procedure.
  • Added the TWVBrowserBase.IsMuted property.
  • Added the TWVBrowserBase.IsDocumentPlayingAudio property.
  • Added the TWVBrowserBase.IsDefaultDownloadDialogOpen property.
  • Added the TWVBrowserBase.DefaultDownloadDialogCornerAlignment property.
  • Added the TWVBrowserBase.DefaultDownloadDialogMargin property.
  • Added the TWVBrowserBase.OpenDefaultDownloadDialog function.
  • Added the TWVBrowserBase.CloseDefaultDownloadDialog function.
  • Updated the WebView2Loader.dll libraries.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

These are the changes since the last announcement :
  • Fixed an issue assigning values to the proxy settings.
  • Added more code comments with WebView2 API references for many properties and events.
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: WebView4Delphi updates

Post by salvadordf »

Hi,

The latest update separated the VCL and FMX packages thanks to Larry Hengen (lhengen)

This change will reduce the size of the final EXE if you use VCL.
Locked