Discussions related to Visual Prolog
Gass
Posts: 16
Joined: 17 Aug 2017 8:51

webView2Demo

Unread post 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
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: webView2Demo

Unread post 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.
Regards Thomas Linder Puls
PDC
Gass
Posts: 16
Joined: 17 Aug 2017 8:51

Re: webView2Demo

Unread post 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
Attachments
test.jpg
test.jpg (118.59 KiB) Viewed 34479 times
Gass
Posts: 16
Joined: 17 Aug 2017 8:51

Re: webView2Demo

Unread post 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
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: webView2Demo

Unread post 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)
Regards Thomas Linder Puls
PDC
Gass
Posts: 16
Joined: 17 Aug 2017 8:51

Re: webView2Demo

Unread post by Gass »

Hi Thomas,
It's ok now, its'run !
Thank you very much
Gass
Post Reply