Page 1 of 1

webView2Demo

Posted: 15 Jul 2021 6:29
by Gass
Hi , about webView2Demo,
I want to integrate webView2Demo into my project, but the dificulty is the following:
this command in main.pro does not work in Taskwindow? (question). Also, the navigation result is not the same with or without this comand especially for the quotes graphic in internet.

Code: Select all

clauses     run() :-         if webView2_api::ensureWebView2() then             webView2::setDefaultEnvironment({ (C) :-                 webView2_api::createCoreWebView2Environment(C, @"..\webView2UserData") }),             _ = mainForm::display(gui::getScreenWindow()),             messageLoop::run()         end if.
thank you for your contribution
regards
Gass

Re: webView2Demo

Posted: 16 Jul 2021 10:47
by Thomas Linder Puls
In an SDI application (with a mainForm) the "main" code looks like this:

Code: Select all

clauses     run() :-         _ = mainForm::display(gui::getScreenWindow()),         messageLoop::run().
In an MDI application (with a taskWindow) then main code looks like this:

Code: Select all

clauses     run() :-         TaskWindow = taskWindow::new(),         TaskWindow:show().
So a possibility could be:

Code: Select all

clauses     run() :-         if webView2_api::ensureWebView2() then             webView2::setDefaultEnvironment(                 { (C) :-                     webView2_api::createCoreWebView2Environment(C, @"..\webView2UserData")                 }),             TaskWindow = taskWindow::new(),             TaskWindow:show()         end if.

Re: webView2Demo

Posted: 17 Jul 2021 7:30
by Gass
Hi Thomas,
Ok with the last command run(), but how to call the class web.frm (web) from Taskwindow, because it appears but nothing concerning Webview2.
thanks again,
regards
Gass

Re: webView2Demo

Posted: 18 Jul 2021 7:21
by Gass
Hi Thomas,
I'm looking for ribbonMdiDemo to maybe find the solution to my problem: launch a program with de web open and navigate.
regards
Gass

Re: webView2Demo

Posted: 19 Jul 2021 8:22
by Thomas Linder Puls
I am not sure if I understand the problem, but maybe this will help.

To show your web form (from your taskWindow), you will have to make a call like this:

Code: Select all

        WebForm = web::display(This)
In the default code a messageForm is displayed in the show-listener, and the aboutdialog is displayed in a menu handler.

You can add additional arguments to web::display (e.g. the URL to navigate to) or you can add additional predicates to its interface. For example you can "export" navigate like this:

Code: Select all

interface web supports formWindow   predicates from iWebView2     navigate ...
And implement it using delegation:

Code: Select all

implement web inherits fromWindow ... delegate    navigate to webView2_ctl
Given that you can start and navigate like this:

Code: Select all

        WebForm = web::display(This),         WebForm:navigate(Url)

Re: webView2Demo

Posted: 20 Jul 2021 5:23
by Gass
Hi Thomas,
It's ok now, its'run !
Thank you very much
Gass