Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

FMX.TMSWebGMapsWebBrowser.Win and Tdcef3

 Post Reply Post Reply
Author
WIERZBICKI Stephane View Drop Down
Member
Member
Avatar

Joined: 29 Jan 2016
Posts: 80
Post Options Post Options   Quote WIERZBICKI Stephane Quote  Post ReplyReply Direct Link To This Post Topic: FMX.TMSWebGMapsWebBrowser.Win and Tdcef3
    Posted: 10 Jun 2016 at 10:45am
Hello,

I'm using Delphi Berlin and TWebBrowser is unusable on Windows platform (just try by yourself and have a look at quality.embarcadero.com)

The only solution I've found was to use Chromium (your components already handle this). An updated version of dcef3 is available at https://github.com/hgourvest/dcef3 . This version works on both VCL and FMX frameworks, tested on Delphi Berlin / Windows 10.

TMS code should be updated to reflect changes because both FMX.TMSWebGMapsWebBrowser.Win and FMX.TMSWebBrowser.Win units fails to compile.

These events need to be updated :
    {$IFDEF USECHROMIUM}
    procedure BeforeBrowse(Sender: TObject;const browser: ICefBrowser; const frame: ICefFrame;
     const request: ICefRequest; isRedirect: Boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject;
     const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
    {$ENDIF}

I've also updated TTMSFMXWinWebGMapsWebBrowser.LoadFile(AFile: String).

procedure TTMSFMXWinWebOSMapsWebBrowser.LoadFile(AFile: String);
{$IFDEF USEFMXWEBBROWSER}
var
  FileStream: TFileStream;
{$ENDIF}
begin
  {$IFDEF USECHROMIUM}
  if Assigned(FWebBrowser) and Assigned(FWebBrowser.Browser) and Assigned(FWebBrowser.Browser.MainFrame) then
    FWebBrowser.Browser.MainFrame.LoadString(AFile, 'localhost');
  {$ENDIF}
  {$IFDEF USEFMXWEBBROWSER}
  WaitForInitialization;
  FileStream := TFileStream.Create(AFile, fmOpenRead or fmShareDenyNone);
  try
    InternalLoadDocumentFromStream(FileStream);
  finally
    FileStream.Free;
  end;
  {$ENDIF}
end;

Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3574
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jun 2016 at 11:23am
Can you mention which specific issues you are experiencing with TTMSFMXWebGMaps or TTMSFMXWebBrowser specifically?
Back to Top
WIERZBICKI Stephane View Drop Down
Member
Member
Avatar

Joined: 29 Jan 2016
Posts: 80
Post Options Post Options   Quote WIERZBICKI Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jun 2016 at 11:46am
Some errors I recall :

Component (align property set to all client) is placed inside a TTabItem (align property set to right client). Here are my issues :
- Component stay "empty" when not parented to form. I have to change the visible property to have content displayed
-  Component isn't correctly drawn when maximizing/minimizing the main form : draw twice,maximized and minimized
- When loading gmaps data (tested with TMSFMXWebBrowser) : I had a warning that browser was set to compatibility mode
- When loading gmaps data (tested with TMSFMXWebBrowser) : tiles where not loaded after closing left drawer and alter messages
- When loading gmaps data (tested with TMSFMXWebBrowser) : received Exception EOleException 80020101 when trying to navigate to another url

URL used : https://www.google.fr/maps/place/Bruxelles,+Belgique/@50.8550625,4.3053506,12z/data=!3m1!4b1!4m5!3m4!1s0x47c3a4ed73c76867:0xc18b3a66787302a7!8m2!3d50.8503396!4d4.3517103

Os : Windows 10 Pro

Ps : no errors at all when switching to DCef3
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3574
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jun 2016 at 1:08pm
We have investigated this here but wouldn't it be better to change the CEF source in order to accomodate for the existing event handlers? Also the CEF correct function is LoadFile, not LoadString in the LoadFile call?
Back to Top
WIERZBICKI Stephane View Drop Down
Member
Member
Avatar

Joined: 29 Jan 2016
Posts: 80
Post Options Post Options   Quote WIERZBICKI Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jun 2016 at 1:47pm
CEF 3 doesn't include loadstream and loadfile functions. These method was introduced in CEF 1.
CEF 1 is only maintained for bug fixing. All new features are implemented in CEF 3.

CEF 3 is multi-threaded while CEF 1 is single threaded.


Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3574
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jun 2016 at 4:05pm
What I meant was to modify the event handlers in CEF3 (ceffmx.pas) to match the ones defined in the FMX.TMSWebGMapsWebBrowser.Win source and create a LoadFile that internally calls the correct method. You can work on a copy of CEF3. This way we keep compatibility with CEF1, accommodate for other users that might still use CEF1, and then you can use CEF3 instead of using the default TWebBrowser implementation.
Back to Top
WIERZBICKI Stephane View Drop Down
Member
Member
Avatar

Joined: 29 Jan 2016
Posts: 80
Post Options Post Options   Quote WIERZBICKI Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 13 Jun 2016 at 2:00pm
I see. I'll ask Herv? Gouvest. He is maintaining the DCEF3 repository.
Back to Top
WIERZBICKI Stephane View Drop Down
Member
Member
Avatar

Joined: 29 Jan 2016
Posts: 80
Post Options Post Options   Quote WIERZBICKI Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jun 2016 at 9:03am
Would it not be wiser to modify FMX.TMSWebGMapsWebBrowser.Win and FMX.TMSWebOSMapsWebBrowser.Win

{$IFNDEF CHROMIUMOFF}
{$DEFINE USECHROMIUM}
{.$DEFINE USECHROMIUM3}
{$ELSE}
...
    {$IFDEF USECHROMIUM}
    procedure BeforeBrowse(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
    const request: ICefRequest; navType: TCefHandlerNavtype;
    isRedirect: boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer; out Result: Boolean);
    {$ENDIF}
    {$IFDEF USECHROMIUM}
    procedure BeforeBrowse(Sender: TObject;const browser: ICefBrowser; const frame: ICefFrame;
     const request: ICefRequest; isRedirect: Boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject;
     const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
    {$ENDIF}
    {$IFDEF USECHROMIUM3}
    procedure BeforeBrowse(Sender: TObject;const browser: ICefBrowser; const frame: ICefFrame;
     const request: ICefRequest; isRedirect: Boolean; out Result: Boolean);
    procedure LoadEnd(Sender: TObject;
     const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
    {$ENDIF}

and so on....
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3574
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jun 2016 at 11:25am
We will investigate if we can improve this behavior.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down