Jump to content
MMSoft

Mouse cursor

Recommended Posts

3 hours ago, Dave Nottage said:

It appears Android's WebView does not like part of the JavaScript (it works on macOS and iOS). I'm looking into it

I discovered what the problem is: The "default" TWebBrowser implementation for Android uses loadUrl:

procedure TAndroidWebBrowserService.EvaluateJavaScript(const AJavaScript: string);
begin
  FWebView.loadUrl(StringToJString('javascript:' + AJavaScript));
  UpdateContentFromControl;
end;

Which I guess does not accept the JavaScript that I provided. In TWebBrowserExt, it uses the evaluateJavascript method:

procedure TPlatformWebBrowserExt.ExecuteJavaScript(const AJavaScript: string; const AHandler: TJavaScriptResultProc);
begin
  if FWebView <> nil then
    FWebView.evaluateJavascript(StringToJString(AJavaScript), CreateValueCallback(AHandler))
  else
    AHandler(cJavaScriptNullResult, -1);
end;

Which does work. I've now added a demo to the HowTo repository, which uses TWebBrowserExt, and it works on Android (as well as iOS and macOS)

Share this post


Link to post

Sorry I can't get it to work, I already have a long list of folders in which Delphi contains the necessary 
files, and I have the idea that now all files can be found.
But now I get this error message:
[DCC Error] Unit1.pas(69): E2003 Undeclared identifier: 'cJavaScriptClickAtXY'
It's possible that I'm using the wrong (outdated) file

Share this post


Link to post
1 hour ago, MMSoft said:

I have the idea that now all files can be found.
But now I get this error message:
[DCC Error] Unit1.pas(69): E2003 Undeclared identifier: 'cJavaScriptClickAtXY'

The demo shows all the required folders in the Search path of Project Options. For that identifier you'd be missing the Features\JavaScript folder of Kastri

Share this post


Link to post

Just downloaded the latest version: https://github.com/DelphiWorlds/Kastri

 

And set up these search paths:
C:\Users\mvsan\Downloads\Kastri-master\Kastri-master\Core
C:\Users\mvsan\Downloads\Kastri-master\Kastri-master\API
C:\Users\mvsan\Downloads\Kastri-master\Kastri-master\Controls
C:\Users\mvsan\Downloads\Kastri-master\Kastri-master\Features\JavaScript
C:\Users\mvsan\Downloads\Kastri-master\Kastri-master\Features\WebBrowserExt

 

But keep getting this error message:
[DCC Error] Unit1.pas(69): E2003 Undeclared identifier: 'cJavaScriptClickAtXY'
[DCC Error] Unit1.pas(69): E2250 There is no overloaded version of 'Format' that can be called with these arguments
 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×