Page 1 of 1

WebViewGAdget and 'core\add_NavigationCompleted' interface option

Posted: Fri May 10, 2024 11:18 am
by zikitrake
Following the example given by Fred in this post (https://www.purebasic.fr/english/viewto ... 16#p615816), has anyone used (or knows how to use) the following option?

core\add_NavigationCompleted (to detect when a page has been fully loaded)


Fred sample code:

Code: Select all

OpenWindow(0, 100, 100, 400, 400, "Hello", #PB_Window_SystemMenu)

WebViewGadget(0, 0, 0, 400, 400, #PB_WebView_Debug)

; Get the ICoreController interface 
;
Controller.ICoreWebView2Controller = GetGadgetAttribute(0, #PB_WebView_ICoreController)

; Get the ICoreWebView2 interface 
;
Controller\get_CoreWebView2(@Core.ICoreWebView2)
Core\Navigate("https://www.purebasic.com")

;!!!!!!!!!!! I Don't know how to implement this  :D 
Repeat
Until ¿¿¿¿¿core\add_NavigationCompleted()????
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

DataSection
	IID_ICoreWebView2Controller2:
	Data.l $C979903E
	Data.w $D4CA, $4228
	Data.b $92, $EB, $47, $EE, $3F, $A9, $6E, $AB
EndDataSection

If Controller\QueryInterface(?IID_ICoreWebView2Controller2, @Controller2.ICoreWebView2Controller2) = #S_OK
  Debug "ICoreWebView2Controller2 found: " + Controller2
Else
  Debug "Can't query ICoreWebView2Controller2"
EndIf

Repeat 
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow

Thank you in advance :)

Re: WebViewGAdget and 'core\add_NavigationCompleted' interface option

Posted: Fri May 10, 2024 11:38 am
by Kiffi
AFAIK core\add_NavigationCompleted() needs an EventHandler. Unfortunately, I don't know how to pass the parameters correctly.

(See also: https://www.purebasic.fr/english/viewto ... 86#p620686)

Re: WebViewGAdget and 'core\add_NavigationCompleted' interface option

Posted: Fri May 10, 2024 11:45 am
by zikitrake
Thanks, I didn't see it!
Let's see if someone can enlighten us :D