[Gambas-user] Some documentation for webview in 3.16 execjavascript ??

Martin mbelmonte at belmotek.net
Sun Jun 27 11:44:28 CEST 2021


ok, i use this code snippet from FTextEditor.class

Public Sub Preview_Ready()

   If $bMovePreviewOnReady Then
     $bMovePreviewOnReady = False
     Try $hPreview.ExecJavascript("goto_line(" & CStr($hEditor.Line) & ");")
     If Error Then Error Error.Text
   Endif
   $bPreviewReady = True

End

Then i use in my sample project this:

Public Sub tobColor_Click()

      Try WebView1.ExecJavascript("goto_line(" & CStr(2) & ");")
      If Error Then Error Error.Text

   WebView1.SetFocus()

End

thi error was returned:

Javascript error: TypeError: undefined is not a function



On 25/6/21 23:24, Bruce Steers wrote:
>
>
> On Fri, 25 Jun 2021 at 11:02, Martin <mbelmonte at belmotek.net 
> <mailto:mbelmonte at belmotek.net>> wrote:
>
>     what I would like to know is, if it is possible or not, to send
>     javascript commands to the WebView control of the gb.gtk3.webview
>     component, of course without enabling gb.qt5.webkit in the
>     project, since that would imply disabling gb.gtk3.webview.
>
>
> The Gambas IDE uses a webview and Javascript controls (with either qt 
> or gtk) when you preview a html/md document.
>
> You can use Benoits code as an example.
> it is in the FTextEditor.class
> https://gitlab.com/gambas/gambas/-/blob/master/app/src/gambas3/.src/Editor/Code/FTextEditor.class 
> <https://gitlab.com/gambas/gambas/-/blob/master/app/src/gambas3/.src/Editor/Code/FTextEditor.class>
>
> Line 1779  Public Sub Preview_Ready()
> and
> line 1790 Private Sub RefreshPreview(Optional bReload As Boolean)
>
> Maybe that helps.
> BruceS
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210627/48b847ce/attachment.htm>


More information about the User mailing list