Page 12 of 13
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Thu Jan 04, 2024 12:30 pm
by Justin
This should fix the *browser issue:
Code: Select all
Procedure IfThisLinkOk(Passed_suri$) ; vm
Protected.BROWSER *browser
Debug "1 LINK Procedure IfThisLinkOk = " + Passed_suri$ ; vm"
ThisLinkItemOk = #False
ResetList(ThisLinkList())
While NextElement(ThisLinkList())
CurrentElementContent$ = ThisLinkList()
; Debug "IfThisLinkOk CurrentElementContent$" + CurrentElementContent$
Position = FindString(Passed_suri$, CurrentElementContent$ , 0 )
If Position > 0
Debug "ThisLinkItemOk = #True " + Passed_suri$
ThisLinkItemOk = #True
EndIf ; Greater than 0 == Yes its a Hit
Wend
If ThisLinkItemOk = #False
; GO TO: https://kidsafebrowser.us/Warning-UnSafe-Site.html
*browser = tab_GetCurrentBrowser()
If *browser
*browser\core\Navigate("http://kidsafebrowser.us/Warning-UnSafe-Site.html") ;
EndIf
EndIf
EndProcedure ; IfThisLinkOk()
With enableexplicit you will need to declare the rest of your local procedure variables using Protected
If the url is the result of SourceChanged event you will need to use the location.replace() method i posted before, otherwise you can't use Go Back navigation because it returns to the unwanted url.
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Thu Jan 11, 2024 6:46 pm
by vmars316
Thanks Again Justin ,
It took me a while to fit it all together ,
but all is working perfectly .
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Fri Jan 12, 2024 5:37 pm
by vmars316
Hi Justin ,
Shucks , thought I had it licked :
Turns out , the Address-Bar doesn't get updated .
I'm thinking here is a promising spot to update it :
Code: Select all
sender\get_Source(@uri)
If uri
suri = PeekS(uri)
Debug "Procedure core_NavigationCompleted suri = " + suri
str_FreeCoMemString(uri)
EndIf
in here :
Code: Select all
Procedure core_NavigationCompleted(this.IWV2EventHandler, sender.ICoreWebView2, args.ICoreWebView2NavigationCompletedEventArgs)
Protected.i uri, title
Protected.s suri, stitle, host, iconUrl
Protected.BROWSER *browser, *currBrowser
;Debug "Procedure core_NavigationCompleted() = " + suri + " Passed_suri$ = " + Passed_suri$
this\LockMutex()
*browser = this\GetContext()
sender\get_Source(@uri)
If uri
suri = PeekS(uri)
Debug "Procedure core_NavigationCompleted suri = " + suri
str_FreeCoMemString(uri)
EndIf
host = GetURLPart(suri, #PB_URL_Site)
If host
;Get favicon
; *browser\core\ExecuteScript(#FAVICON_SCRIPT_GET_ICON, wv2_EventHandler_New(@favicon_ScriptExecuted(), *browser))
EndIf
sender\get_DocumentTitle(@title)
If title
stitle = PeekS(title)
Debug "Procedure core_NavigationCompleted stitle = " + stitle
str_FreeCoMemString(title)
EndIf
; url_Edit_SetText(app\url, suri)
If stitle = ""
stitle = "New tab"
EndIf
tabCtrl_SetItemText2(app\tab, browser_GetTabIndex(*browser), stitle, #TAB_MAX_ITEM_WIDTH)
this\UnlockMutex()
EndProcedure ; core_NavigationCompleted
How can I do that ?
Thanks
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Fri Jan 12, 2024 10:11 pm
by Justin
The address bar is updated in the core_SourceChanged() event, search for the core_SourceChanged() procedure in the last Ohm.pb version at github to see how it's done:
https://github.com/omegakode/PBWebview2 ... ser/Ohm.pb
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Thu Jan 18, 2024 5:45 pm
by vmars316
Ah perfect , Thanks Justin
Looks like I had commented out this puppy:
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Thu Feb 15, 2024 8:36 pm
by infratec
Made my stuff PB 6.10 compatible.
I had to add many CompilerIfs
But it seams that it works better (smother) in 6.04 then in 6.10 or it is my PC.
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Thu Feb 15, 2024 10:45 pm
by Justin
Hi,
The next update will make things much easier, for now it uses the api control but i'll try to integrate the new WebGadget.
I didn't notice any difference, a very good thing of 6.10 is that the dll can be linked statically.
Here is a sneak preview with theme transitions in 6.10:

Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Sun Aug 04, 2024 5:13 am
by ricardo
Hi,
I downloaded from GitHub, but i tried to run any example, it does not find some files
Code: Select all
XIncludeFile "math.pb"
XIncludeFile "Unsigned.pb"
XIncludeFile "stream.pb"
XIncludeFile "resource.pb"
XIncludeFile "json.pb"
XIncludeFile "keyboard.pb"
XIncludeFile "enum.pb"
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Sun Aug 04, 2024 9:21 am
by Justin
Hi,
it's fixed now. I no longer update this repo, i will put the updated pb Webview2 headers only in another one.
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Sun Aug 04, 2024 9:41 am
by useful
Justin wrote: Thu Feb 15, 2024 10:45 pm
I didn't notice any difference, a very good thing of 6.10 is that the dll can be linked statically.
Where can I read about this feature?
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Sun Aug 04, 2024 12:07 pm
by Justin
With the new linker it's easier to import static libraries.
For example in WebView2Loader.pbi if you change:
Import "x64\WebView2Loader.lib"
to
Import "x64\WebView2LoaderStatic.lib"
you don't need to ship WebView2Loader.dll with the exe, it is compiled with the executable.
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Sun Aug 04, 2024 1:34 pm
by useful
It's obvious about lib, but I read about dll in your message, I was surprised and therefore asked a question
Justin wrote: Thu Feb 15, 2024 10:45 pm
... dll can be linked statically.
Re: Webview2 control - Chromium browser for Purebasic (Windows)
Posted: Mon Aug 05, 2024 7:02 am
by ricardo
infratec wrote: Fri Nov 10, 2023 7:40 am
Is WebView2 runtime installed?
In Win 10 this should be the cas if your PC is up to date.
But check it in the software control paneL
It is called: Microsoft Edge WebView2 runtime
If not, you have to install it.
Oh, and if you use PB x64 you have to copy the WebView2Loader.dll from the x64 subdirectory.
I run WebView2Gadget.pbi using PB 6.11 and no window was displayed. I have the runtime installed.
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Mon Aug 05, 2024 7:04 am
by ricardo
Its possible using this gadget to navigate to some website and use javascript to interact?
Thanks in advance!!
Re: Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]
Posted: Sun Aug 18, 2024 12:58 pm
by Erolcum