TMSFMXWebBrowser not catching navigation events

Hi,


TMSFMXBrowser is not catching any events, running under Windows. It works fine in MacOS. 

When I disable the flag {$DEFINE CHROMIUMOFF} in the TMSDEFS.INC file, it works, but this is deprecated for Rad Studio versions above XE8. I'm using Berlin 10.1 with the latest update.

Do you have a solution? Chromium usage would be fine, but I also have problems with backspace being intercepted even when the browser doesn't have focus (btw- do you have a solution for this?)


Hi, 


Can you please explain exactly in which circumstances the browser is not catching events? Please note that it uses the TWebBrowser internally and the backpsace issue is unfortunately also reproducible on TWebBrowser.

I'm using RAD Studio Berlin 10.1 under Windows 10. 


Both events (OnBeforeNavigate and OnNavigationComplete) are simply bypassed. If I comment the {$DEFINE CHROMIUMOFF} flag, both events start working fine. Under MacOS all works. 

When I use a TWebBrowser, the events (OnDidStartLoad and OnDidFinishLoad) are also triggered ok.

I'd like to keep on using your browser, TWebBrowser has other issues like this one: http://stackoverflow.com/questions/33612393/can-you-intercept-hyperlink-clicks-with-firemonkey-cross-platform which yours doesn't (can you comment on that one?).



About the backspace issue, what do you advise? The only thing that seems to work is to disable the browser when you catch a backspace during a KeyDown event, but then you have a bunch of other problems...

Hi, 


The events and backspace work as expected here while navigating to google. In RAD Studio Berlin 10.1 there is no additional setup necessary. Chromium is no longer needed. At which URL does the issue occur?

We have tested this here with a default TTMSFMXWebBrowser on the form and the following code:

TMSFMXWebBrowser1.Navigate('http://www.google.com');

Pieter Scheldeman2016-10-17 13:54:25

The issue is happening using an internal HREF link inside some runtime generated HTML. Just retested and no event is triggered, either using an HREF inside the manually loaded HTML or by manually doing:


MainBrowser.URL:= 'http://www.google.com';
MainBrowser.Navigate;



Can you provide us with a sample that demonstrates this issue?

Please download this simple test app: https://dl.dropboxusercontent.com/u/2208225/OmneeK/TMSTestApp.7z


Test with the included binaries I sent along with the source code. The first button loads into a TMS Browser. It should show a message when for each event. The second button does the same into a TWebBrowser. It shows messages for both events.

This was tested (but not compiled) in other machines. At runtime it behaves the same so it's not specific to my work machine registry.

Hi, 


You can only use one instance of TWebBrowser. When using TWebBrowser it consumes the events. Please remove TWebBrowser and only use TTMSFMXWebBrowser.

This should be documented. 


After removing the TWebBrowser and it's unit reference from the demo app, it started catching the events. I did the same in my main app and still it doesn't catch the events. I didn't have a TWebBrowser there. Any thoughts about something else needing to be removed?

This is my uses list:


interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, UniProvider,
  SQLiteUniProvider, Data.DB, DBAccess, Uni, FMX.ExtCtrls, FMX.TMSCustomEdit,
  FMX.TMSSearchEdit, FMX.ScrollBox, FMX.Memo,
  FMX.ListBox, FMX.Layouts, FMX.TMSWebBrowser, FMX.Menus, IdBaseComponent,
  IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, Xml.xmldom, Xml.XMLIntf,
  Xml.XMLDoc, FMX.Edit, FMX.ComboEdit, System.ImageList, FMX.ImgList,
  IdServerIOHandler, IdSSL, IdSSLOpenSSL;

(...)

uses
  core_interface, core_string_utils, System.IOUtils, learn_file_form, Math, core_summary, StrUtils,
  IdURI, DateUtils, settings_form, HTTPApp, extracted_meanings_form, logs_form, Inifiles;


Any flags raised?

It's unclear what exactly is going wrong in your application. Are you using frame, or creating an instance of TTMSFMXWebBrowser at runtime? Did you include it as a child of another component?

It's at design time, inside a TPanel.

Tested this here, but on a TPanel the events are still triggered. If you can reconstruct this in a separate sample this would be helpful, but you could also try to call an initialize in the formshow, to see if the events are triggered:


TMSFMXWebBrowser1.Initialize;
TMSFMXWebBrowser1.URL := 'http://www.google.com';

As crazy as this may sound, when you have more than one form being auto-created in a project, the events stop being triggered. Please test by adding a new TForm into the simple app I sent you let it be auto-created. Here's a new link for my compilation: https://dl.dropboxusercontent.com/u/2208225/OmneeK/TMSTestApp_second_form.7z

Hi, 


We have tested the last sample with the second form and could see the messages, so on our testing environment the events are triggered. Are you using Berlin with or without update 1?


With update 1 and I can confirm that this happens with all the projects I test with.

Was the second form in Auto-create in your test?

I have downloaded and opened your test application, without any changes, is there anything else that needed to change in order to reproduce the issue? The TMSTestApp_second_form.7z contains the following code in the dpr file:


program TestTMSApp;

uses
  System.StartUpCopy,
  FMX.Forms,
  main_form in 'main_form.pas' {Form2},
  second_form in 'second_form.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.