标题
原来 lazarus 下的 Handle 实现是 NSView 的指针
clq
浏览(6) +
2025-10-10 16:18:56 发表
编辑
关键字:
原来 lazarus 下的 Handle 实现是 NSView 的指针 之前一直在找,无意中发现了... -------------------------------------------------------- //用新的浏览器控件 WKWebView procedure TFormWebView.CreateWeb2(); var WebFrame: NSRect; //Prefs: WebPreferences; WebConfig: WKWebViewConfiguration; begin // 设置窗体大小 Width := 800; Height := 600; //---- // 创建配置 //WebConfig := WKWebViewConfiguration.alloc.init; // 启用 JavaScript //WebConfig.preferences.setJavaScriptEnabled(True); //WebConfig.preferences.setJavaScriptCanOpenWindowsAutomatically(True); //---- // 创建 WebView WebFrame := NSMakeRect(0, 0, Width, Height); // //WebView3 := WKWebView.alloc.initWithFrame(WebFrame); //不带配置的 WebView3 := WKWebView.alloc.initWithFrame_configuration(WebFrame, CreateWebViewConfig); //带配置的 ,也成功了。不过不用似乎也可以,或者说是配置会保存? WebView3.setAutoresizingMask(NSViewWidthSizable or NSViewHeightSizable); NSView(Handle).addSubview(WebView3); WebView3.setAutoresizingMask(NSViewWidthSizable or NSViewHeightSizable); //-- //WebView3.allowsBackForwardNavigationGestures := ObjCBOOL(true); WebView3.setAllowsBackForwardNavigationGestures(true); //这个只是手势前进后退是否允许 //-- //WebView3.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(NSStr(PChar('https://www.baidu.com/'))))); ////WebView3.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(NSStr(PChar('https://mail.163.com/'))))); //self.LoadURL2('http://newbt.net'); //self.LoadURL2('https://www.baidu.com'); self.LoadURL2('https://mail.163.com'); end;
NEWBT官方QQ群1: 276678893
可求档连环画,漫画;询问文本处理大师等软件使用技巧;求档softhub软件下载及使用技巧.
但不可"开车",严禁国家敏感话题,不可求档涉及版权的文档软件.
验证问题说明申请入群原因即可.