Webview not displaying in MacOS using Delphi XE2

后端 未结 2 635
旧时难觅i
旧时难觅i 2021-02-06 20:07

I have started to convert the Webview interfaces to be consumed in Delphi. I have managed to get the webkit library to load, and the interface methods that is called appears to

2条回答
  •  悲哀的现实
    2021-02-06 20:41

    Getting the NSWindow of a FMX form
    convert a TForm reference to a NSWindow
    set Host Window.
    MyWebView.setHostWindow(MyNSWindow)

    procedure TForm2.Button1Click(Sender: TObject);
    var
    [...]
     ObjTOC: TOCLocal;
     MyNSWindow : NSWindow;
    [...]  
     ObjTOC := (FmxHandleToObjC(Form2.Handle) as TOCLocal);
     MyNSWindow := NSWindow(TOCLocalAccess(ObjTOC).Super);
    
    PWebView := TWebView.Alloc.initWithFrame(MakeNSRect(10, 10, 300, 300), nil, nil);
     MyWebView := TWebView.Wrap(PWebView);
     MyWebView.setHostWindow(MyNSWindow);
    
    [...]
     MyWebView.mainFrame.loadRequest(urlreq);
    end;
    

提交回复
热议问题