I just switched to the TMS AdvWebBrowser. I want to set the ZoomFactor in the OnNavigateComplete event. My previous (much older) browser object has the ZoomFactor surfaced and I could just set it. I use the CTRL+/CTRL- to set this after the fact now , but I wonder if it can be done with ExececuteJavascript();
Thanks,
Lou
uses
AdvWebBrowser.Win;
procedure TForm1.Button1Click(Sender: TObject);
var
c: ICoreWebView2Controller;
begin
c := ICoreWebView2Controller(AdvWebBrowser1.NativeBrowser);
if Assigned(c) then
begin
c.put_ZoomFactor(10);
end;
end;
Where might I have found this piece of information? I did look in the TMS documentation I had. With this in hand, I found a Microsoft reference to the WebCore2 object. I'll look that over. Any TMS documentation or demos?
Thanks,
Lou
The TAdvWebBrowser exposes the NativeBrowser property and gives access to the internal Windows APIs. the TAdvWebBrowser is a port from FNC and the zoom factor is not something that can be implemented in a cross platform way, therefore it is not exposed yet. We'll investigate if we can expose it for TAdvWebBrowser as this only targets Windows. The APIs for Windows specific are explained here (WebView2 Win32 C++ Reference | Microsoft Docs), but please note that not all APIs are implemented.
Yes ,but in your original post you mentioned, you wanted to set the zoom factor, which is with put_zoomFactor(). If you want to retrieve the zoom factor you need to use:
uses
AdvWebBrowser.Win;
procedure TForm1.Button1Click(Sender: TObject);
var
c: ICoreWebView2Controller;
zf: Double;
begin
c := ICoreWebView2Controller(AdvWebBrowser1.NativeBrowser);
if Assigned(c) then
begin
c.get_ZoomFactor(@zf);
end;
end;