-
Content Count
1609 -
Joined
-
Last visited
-
Days Won
36
Posts posted by Dave Nottage
-
-
Mouse cursor
in FMX
2 minutes ago, MMSoft said:Could not find a part of the path 'C:\Users\mvsan\Documents\Embarcadero\Studio\Projects\TEST\Lib\dw-kastri-base-3.0.0.jar'.
The jar is not added to the search paths, it's added to the Libraries node of the Android 32-bit target, as per the demo readme. This is an image (which has been shortened, for brevity) of it:
4 minutes ago, MMSoft said:I've added these Search Paths for this:
You don't add those paths. See above.
-
Mouse cursor
in FMX
13 hours ago, MMSoft said:[DCC Error] Unit1.pas(69): E2003 Undeclared identifier: 'cJavaScriptClickAtXY'
It's definitely in the repo.
https://github.com/DelphiWorlds/Kastri/blob/58569bee28f5ce3caf5ceef588a46d13c161ce62/Features/JavaScript/DW.JavaScript.pas#L20Did you add DW.JavaScript to the uses clause, as per the demo?
-
On 9/10/2024 at 7:25 PM, Dave Nottage said:Reversing the calls fixes it for me
That now fails for me in Delphi 12.2 😞
Rollo's example, i.e.:
TabControl1.SetActiveTabWithTransition(TabItem1, TTabTransition.Slide, TTabTransitionDirection.Normal); TThread.ForceQueue(nil, procedure begin FPDFControl.LoadPDF(LFileName); end);
Works ok for me in Delphi 12.2
-
Mouse cursor
in FMX
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
-
Mouse cursor
in FMX
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)
-
Mouse cursor
in FMX
31 minutes ago, Dave Nottage said:Not sure why it's not working for you
It appears Android's WebView does not like part of the JavaScript (it works on macOS and iOS). I'm looking into it
-
Mouse cursor
in FMX
8 minutes ago, MMSoft said:Unfortunately, nothing is happening yet
Not sure why it's not working for you - I'm using the same URL as in your example. I could put together a minimal test case to demonstrate it.
-
4 hours ago, Fudley said:In this case, FMX.Listbox is definately in the uses clause
Please post a reproducible example.
-
Mouse cursor
in FMX
37 minutes ago, Dave Nottage said:When it needs to be on the anchor (a) element, so I'll need to tweak the JavaScript a bit.
Updated JavaScript:
cJavaScriptClickAtXY = '(function() {'#13#10 + 'var windowX = %d, windowY = %d'#13#10 + 'let x = windowX - (window.scrollX || window.pageXOffset)'#13#10 + 'let y = windowY - (window.scrollY || window.pageYOffset);'#13#10 + 'var element = document.elementFromPoint(x, y);'#13#10 + 'while (element) {'#13#10 + ' if (element.tagName !== "A" && !element.hasAttribute("onclick"))'#13#10 + ' element = element.parentElement;'#13#10 + ' else'#13#10 + ' break;'#13#10 + '}'#13#10 + 'if (element) {'#13#10 + ' var clickEvent = document.createEvent("MouseEvents");'#13#10 + ' clickEvent.initMouseEvent("click", true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null);'#13#10 + ' element.dispatchEvent(clickEvent);'#13#10 + '} else'#13#10 + ' console.log("No clickable element found at coordinates:", x, y);'#13#10 + '})()';
-
Mouse cursor
in FMX
32 minutes ago, MMSoft said:I place the cursor at the top left of the site on the Item "FMX" and give a click.
I think it may be that the click is being invoked on the span, or the image (i):
<li> <a href="https://en.delphipraxis.net/forum/28-fmx/"> <span>FMX <i class="fa fa-angle-right"></i></span> </a> </li>
When it needs to be on the anchor (a) element, so I'll need to tweak the JavaScript a bit.
-
Mouse cursor
in FMX
4 hours ago, MMSoft said:I'm trying to be able to click something on the displayed site so that it executes.
const cJavaScriptClickAtXY = '(function() { '#13#10 + 'var windowX = %d, windowY = %d'#13#10 + 'let x = windowX - (window.scrollX || window.pageXOffset)'#13#10 + 'let y = windowY - (window.scrollY || window.pageYOffset);'#13#10 + 'var element = document.elementFromPoint(x, y);'#13#10 + 'if (element) {'#13#10 + ' var clickEvent = document.createEvent("MouseEvents");'#13#10 + ' clickEvent.initMouseEvent("click", true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null);'#13#10 + ' element.dispatchEvent(clickEvent);'#13#10 + '} else'#13#10 + ' console.log("No element found at coordinates:", x, y);'#13#10 + '})()'; // Example call: WebBrowser1.EvaluateJavaScript(Format(cJavaScriptClickAtXY, [Cursor_Position_X, Cursor_Position_Y]));
The code above should do what you want - it has had very limited testing in my environment
-
Mouse cursor
in FMX
12 hours ago, MMSoft said:I'm trying to create an Android project, where a Web browser shows a Site.
That's not a complete example, and obviously not Windows, so I'm not sure why you felt the need to add a unit that requires Windows.
-
3 hours ago, FabDev said:Delphi say "No provisioning profil has been found in the build configuration and device selected...".
In macOS 15, the location for provisioning profiles is in another folder. One solution to fix this is:
- In Xcode menu, click Xcode > Settings, and select Accounts
- Select the relevant Apple ID (or add yours if none exists in the list)
- Click "Download Manual Profiles"
Then PAServer should find the profile
-
1
-
Mouse cursor
in FMX
34 minutes ago, MMSoft said:Unfortunately I get this error message there:
[DCC Fatal Error] DW.JavaScript.WebView2.pas(6): F2613 Unit 'Winapi.WebView2' not found.Presumably you are attempting to use this unit on a non-Windows platform, which it is not intended for. Please give a complete example of what you are trying to do.
-
8 minutes ago, Ian Branch said:In which version of Delphi were the uses unit's qualifiers like Vcl. & System. introduced?
Delphi 2005
-
1
-
-
1 hour ago, jakicex571 said:The exception raises while setting the text property in the rtl.
I confirm the behaviour
-
Mouse cursor
in FMX
13 hours ago, MMSoft said:If I change the height and/or width of the "NativeImage" it works fine.
Thanks.. I'll look into it
-
Mouse cursor
in FMX
11 hours ago, MMSoft said:Project Test_1.apk raised exception class EJNI with message 'Java type JDWRectangleDrawable could not be found'.
What am I doing wrong?
You need to add dw-kastri-base-3.0.0.jar to the Libraries node of the Android targets. If you want to target both 32-bit and 64-bit, unfortunately because of a bug in Delphi 11.3, you'll need to make a copy of the jar file in another folder in order to be able to add it to both targets.
11 hours ago, MMSoft said:It doesn't matter where I put a "NativeImage" on the form, it comes up
always to be at the top leftI've been having that trouble, too. It works OK for me in some apps, but not in that demo. Still looking into why.
11 hours ago, MMSoft said:If the height or width is slightly icy, it doesn't happen
"Slightly icy"?
-
52 minutes ago, William23668 said:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/ddmlib/Log$ILogOutput has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
You're using the wrong JDK. Later versions of Delphi require Eclipse Temurin Open JDK. In the Delphi menu, click Tools > Manage Features, then scroll the right hand side down to the bottom, select Eclipse Temurin Open JDK and click Apply. You'll then need to configure the Android SDK settings to use it:
-
Mouse cursor
in FMX
6 hours ago, MMSoft said:But I can't get both an Image and a Rectangle visible on top of this TWebBrowser.
You need to use a control that supports proper "z-order" with platform-derived controls such as TWebBrowser. Kastri has such controls (TNativeImage, TNativeRectangle etc), and I've now created a demo that could be used as a starting point to achieve what you want. Please note that you would need to first install the KastriFMX package, which contains the native controls.
-
1
-
-
4 minutes ago, cupboy said:What is the link to download Delphi 10.1 Professional with mobile?
-
Just now, jesu said:If they break compatibility, what's the purpose of calling it 12.2 instead of 13.0?
It wasn't intentional.
-
1 hour ago, jesu said:When I compile a program with 12.2 and deploy to a computer that has 12.1 bpls I get this error:
Same is happening for experts compiled with 12.2, i.e. they will not load in 12.1: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1838
-
4 hours ago, IvanilsonR said:[DCC Error] uLogin.pas(220): E2003 Undeclared identifier: 'TJSettings_Secure'
It's declared in: Androidapi.JNI.Provider
How to Set contentDescription for TImage Component in Delphi FMX for Google Accessibility?
in FMX
Posted
This part will not even compile. TControl does not have a Handle property in FMX.
Nor will this. setContentDescription takes a JCharSequence as the parameter.
The main problem is that "non-native" FMX controls do not have an underlying native control, except when ControlType is Platform. Even then, there is no support for calling setContentDescription on that native control. This would require adding a ContentDescription property to TControl so that it can be passed to the underlying "native" controls. On top of this, only certain controls on Android support ControlType of Platform.