Webview RunScript: how to pass a variable to RunScript?

29 views
Skip to first unread message

Raphael Stonehorse

unread,
Feb 2, 2024, 4:58:37 AMFeb 2
to wx-u...@googlegroups.com
I would like to pass a variable to RunScript method

With:

        wxString txt = "wxWidgets";

        RunScript("let txtS = `${txt}`");

I get: Error running JavaScript: ReferenceError: Can't find variable: txt

How to do that?


Raphael Stonehorse

unread,
Feb 2, 2024, 5:23:52 AMFeb 2
to wx-u...@googlegroups.com
For whoever would like to know the solution, which has been given by DoubleMax in wxWidgets Forum:

wxString txt = "wxWidgets";
wxString script = "let txtS = '" + txt + "';";
RunScript( script );
Reply all
Reply to author
Forward
0 new messages