Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
navigatetostringsync problem
#4
Hi,

That helps, thanks.

The second parameter (IsSuccess in the docs) returns false, so the function correctly returns that it didn't work.
The help is not very clear here. It mostly points you to the 3rd parameter for finding a hint on what was wrong. The value of that parameter is what is returned in the OnNavigationCompleted event if you happened to run the synchronous variant.
But it never reaches this event and that's why that one returns 0. Which leaves you in the dark.
There's also the return status of the function itself and that one actually does return an error (error 22 in this case, a time out) and the help mentions that, but it needs to be rewritten so that it is more clear.

The problem you are having is that during your form activate the control does not yet exist.
The error returns a timeout (which is factually correct), but it would be so much better if it just would have returned an error stating that the control does not yet exist.

There are several ways to address your issue. 
As you are using an asynchronous navigate method, let's stay with that for the moment.
The following does work in VFP.
Code:
LOCAL m.exito, m.TxWebErrorStatus, m.lcHtml, hResult, iError
m.exito = .f.
m.TxWebErrorStatus = 0
hResult = 0
TEXT TO lcHtml NOSHOW PRETEXT 7
<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>Hola Mundo</body></html>
ENDTEXT
thisform.oantview.visible = .t.

thisform.oantview.object.CreateWebViewSync(@hResult)

iError = thisform.oantView.object.NavigateToStringSync(lcHtml,@m.exito,@m.TxWebErrorStatus)
IF !m.exito
    messagebox("No se ha podido navegar Error nº: " + alltrim(str(iError)), 0 + 48)
ENDIF

IF !thisform.oAntview.WebViewCreated
    messagebox("WebView not created yet!")
ENDIF

So the fix is to force a CreateWebViewSync before you navigate.

This is not needed for a normal navigation as those are cached and will be executed after the control is created if those are requested before the control exists.
Sadly this only added to the confusion in this particular scenario as a string navigation is not cached.

Hope this helps,
Wil
Reply


Messages In This Thread
RE: navigatetostringsync problem - by wila - 2026-03-16, 12:06:23
RE: navigatetostringsync problem - by wila - 2026-03-16, 22:28:25
RE: navigatetostringsync problem - by wila - 2026-03-17, 10:30:02
RE: navigatetostringsync problem - by wila - 2026-03-17, 12:02:03
RE: navigatetostringsync problem - by wila - 2026-03-19, 08:55:23

Forum Jump:


Users browsing this thread: 1 Guest(s)