Delphi 10.4.2
I'm working with TEdgeBrowser for the first time and am playing with some ideas in a small demo app I created. I have so far been able to programmatically Navigate to the website, login (fill in the User Name and Password and click the Log In button), click a button (My Cases) to be taken to another page, then filled in an edit field and a combo box to lookup a specific case. So far all is well. Now that the case is available I have the option to click either "History" or "Service information". I clicked on the "History" button and want the new window to open in another TEdgeBrowser component. Here is the code I'm using to attempt to do this but it is not working.
procedure TfrmMain.EdgeBrowserNewWindowRequested(Sender: TCustomEdgeBrowser;
Args: TNewWindowRequestedEventArgs);
begin
//* Natigate to the history page
pgeMain.ActivePage := tabHistory;
//* Open link in another WebView2 (new tab):
Args.ArgsInterface.Set_NewWindow(EdgeBrowserHistory.DefaultInterface);
end;
Please note that I have the following in the FormShow event.
procedure TfrmMain.FormShow(Sender: TObject);
begin
EdgeBrowser.UserDataFolder := 'C:\Temp\';
EdgeBrowserHistory.CreateWebView;
end;
Note: My main browser is call EdgeBrowser
procedure TfrmMain.btnGoClick(Sender: TObject);
begin
pgeMain.ActivePage := tabBrowser;
EdgeBrowser.Navigate(edtWebSiteURL.Text);
end;
Reading other post on this site, I thought maybe it had to do with having a TEdgeBrowser on another page of a TPageControl, so I moved it off to the main form and it still does not work.
If I do not have any code in the EdgeBrowserNewWindowRequested event it will open to a new window just fine. Anyone know what I need to do to get it to work?