MMSoft
Members-
Content Count
21 -
Joined
-
Last visited
Everything posted by MMSoft
-
I'm using Delphi 12.1 and have the option to give my App the option to "Access all files". To do this, I check "Manage external storage" under Uses Permissions. I will display the System Setup screen in which this permission data can be data.: uses Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net; var LIntent: JIntent, LUri: Jnet_Uri; Begin LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil); LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, LUri); LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); TAndroidHelper.Context.startActivity(LIntent); end; But how can I ask whether this Permission has been given ? (sorry for my bad english)
-
Thanks, it works ! (I had been looking for it for days).
-
Let me introduce myself: I program as a hobby, and have been doing it for several years. Because my English is very bad I used a Dutch Forum, but unfortunately that is used very little these days, so hopefully there are still active Delphi users here. (Delphi 11.3, FMX, Android) I would like to add a mouse cursor in my Android(TV) App, and be able to move it and click on an Item. How can I do that? (Sorry for my bad English)
-
I now have a cursor and when I click on a button it executes it (if the page is not moved on the TWebBrowser). Thank you for that! Now my goal is to be able to view a website and use it on an android TV. I had hoped that if I could display a cursor and click on an item I could use a website, but that turns out to be a lot more difficult for me. The 1st problem I run into is that sometimes a site is too big, and it needs to be able to scroll. I have no idea how to make that happen. The 2nd problem is if the site is shifted on the TWebBrowser, clicking on a button on the site no longer works. And the 3rd problem I run into is, how can I enter something on an input field on the site ? Unfortunately, I can't figure this out, and help is very welcome
-
I've been trying for days to get a little further, but unfortunately I can't get any further. For example, I try to ask how many pixels a site is shifted on the WebBrowser. How could I do that? Edit: Because I can't find how to do this, I'm trying to get it done through AI. It comes with the code below, but there I get the error messages: E2034 Too many actual parameters By the rules: procedure(const AResult: string) const JavaScriptHorizontal = 'window.scrollX'; JavaScriptVertical = 'window.scrollY'; procedure TForm1.WebBrowser1DidFinishLoad(ASender: TObject); begin // JavaScript om de huidige horizontale schuifpositie op te halen WebBrowser1.EvaluateJavaScript(JavaScriptHorizontal, procedure(const AResult: string) begin ShowMessage('Horizontaal verschoven: ' + AResult); end ); // JavaScript om de huidige verticale schuifpositie op te halen WebBrowser1.EvaluateJavaScript(JavaScriptVertical, procedure(const AResult: string) begin ShowMessage('Verticaal verschoven: ' + AResult); end ); end;
-
Thanks, it works. I'm now going to try to incorporate it into my own Project. Edit: Is it possible to make a keyboard appear when the magnifying glass is clicked (Search on the site) so that search text can be typed ? Edit2: It now also works in my own App (and it runs on an Android TV). I do come across points for improvement, such as showing a keyboard when there is an input field. But also if the site does not fit on the Web browser to be able to scroll it. Also, if the site has shifted on the WebBrowser, clicking on it will no longer work because this shift will probably have to be taken into account.
-
Of course, I use the demo, but my files are in a different place, so your search paths don't work for me. I'm getting this message now: Could not find a part of the path 'C:\Users\mvsan\Documents\Embarcadero\Studio\Projects\TEST\Lib\dw-kastri-base-3.0.0.jar'.
-
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
-
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
-
Unfortunately, nothing is happening yet
-
The code has been added. I place the cursor at the top left of the site on the Item "FMX" and give a click. But unfortunately, nothing visible happens.
-
This is the code I have now. The cursor works, but now I'm trying to be able to click something on the displayed site so that it executes. unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.ScrollBox, FMX.Memo, FMX.Controls.Presentation, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, IdContext, Androidapi.JNIBridge, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.JavaTypes, Androidapi.Helpers, Androidapi.JNI.NET, System.IOUtils, FMX.Edit, FMX.Objects, FMX.Memo.Types, System.Permissions, Androidapi.Jni.Os, Androidapi.JNI.Webkit, FireDAC.UI.Intf, FireDAC.FMXUI.Wait, FireDAC.Stan.Intf, FireDAC.Comp.UI, FMX.WebBrowser, FMX.Ani, DW.NativeImage, DW.NativeShape; type TForm1 = class(TForm) WebBrowser1: TWebBrowser; NativeImage1: TNativeImage; procedure FormCreate(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); procedure FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Muis_Cursor_Max_Horz: Integer; Muis_Cursor_Max_Vert: Integer; Muis_Cursor_Stap_Groote: Integer; Muis_Cursor_Horz: Integer; Muis_Cursor_Vert: Integer; Site: String; implementation {$R *.fmx} //------------------------------------------------------------------------------ procedure TForm1.FormCreate(Sender: TObject); begin //Form1 Form1.ClientHeight:= 536; //Scherm hoogte Form1.ClientWidth:= 955; //Scherm Breedte //Instel waardes: Muis_Cursor_Max_Horz := 940; Muis_Cursor_Max_Vert := 520; Muis_Cursor_Stap_Groote := 5; //Begin Waardes: Muis_Cursor_Horz := 470; Muis_Cursor_Vert := 260; //De Moude Cursor op het begin punt zetten: NativeImage1.Position.X := Muis_Cursor_Horz; NativeImage1.Position.Y := Muis_Cursor_Vert; end; //------------------------------------------------------------------------------ procedure TForm1.FormActivate(Sender: TObject); begin Site:= 'https://en.delphipraxis.net/topic/12144-mouse-cursor/'; WebBrowser1.Navigate ( Site ); end; //------------------------------------------------------------------------------ procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); begin if Key = vkDown then begin Muis_Cursor_Vert := Muis_Cursor_Vert + Muis_Cursor_Stap_Groote; if Muis_Cursor_Vert > Muis_Cursor_Max_Vert then Muis_Cursor_Vert := 0; NativeImage1.Position.Y := Muis_Cursor_Vert; end; if Key = vkUp then begin if Muis_Cursor_Vert > -1 then Muis_Cursor_Vert := Muis_Cursor_Vert - Muis_Cursor_Stap_Groote; if Muis_Cursor_Vert < 0 then Muis_Cursor_Vert := Muis_Cursor_Max_Vert; NativeImage1.Position.Y := Muis_Cursor_Vert; end; if Key = vkRight then begin Muis_Cursor_Horz := Muis_Cursor_Horz + Muis_Cursor_Stap_Groote; if Muis_Cursor_Horz > Muis_Cursor_Max_Horz then Muis_Cursor_Horz := 0; NativeImage1.Position.X := Muis_Cursor_Horz; end; if Key = vkLeft then begin if Muis_Cursor_Horz > -1 then Muis_Cursor_Horz := Muis_Cursor_Horz - Muis_Cursor_Stap_Groote; if Muis_Cursor_Horz < 0 then Muis_Cursor_Horz := Muis_Cursor_Max_Horz; NativeImage1.Position.X := Muis_Cursor_Horz; end; end; //------------------------------------------------------------------------------ procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); var Cursor_Position_X: Integer; Cursor_Position_Y: Integer; begin if ((vartostr(Key) = '0') and (KeyChar = '')) then begin //Op OK gedrukt Cursor_Position_X := Round( NativeImage1.Position.X ); Cursor_Position_Y := Round( NativeImage1.Position.Y ); end; end; //------------------------------------------------------------------------------ end.
-
I'm trying to create an Android project, where a Web browser shows a Site. With the Cursor I then point to an Item, and with a click I want to run that item. I have the 1st part working, now I'm still trying to get the 2nd part working.
-
To be able to start something on a site that is on the TWebBrowser, I am looking at the Demo "WebBrowserExt" Do you think this demo can be used for this? Unfortunately I get this error message there: [DCC Fatal Error] DW.JavaScript.WebView2.pas(6): F2613 Unit 'Winapi.WebView2' not found. I have the search path at: Project > Options > Delphi Compiler > Search path Set to the file: DW.JavaScript.WebView2.pas But unfortunately, the error message is still there. How can I get this to work ?
-
As for the next problem (starting something on the site that is on the TWebBrowser). Unfortunately, it is very complicated for me, but can we do something with this? (see Rik's post 30 Sep. 10:44) https://www.nldelphi.com/forum/vraagbaak/firemonkey/44452-/page2 Edit: As I understand I need to figure out the "ElementId": //Run JavaScript code to simulate a click on TWebBrowser procedure SimulateClick(WebBrowser: TWebBrowser; ElementId: string); var Script: string; begin Script := Format('document.getElementById('%s').click();', [ElementId]); WebBrowser.ExecuteScript(Script); end; Who has experience with this?
-
I switched to Delphi 12 (didn't test this again in 11.3) If I change the height and/or width of the "NativeImage" it works fine.
-
There is still a difference between the Demo and my Project and I can't seem to find what I'm doing wrong, so I started a new project, but this time with a "NativeRectangle". If I put in the Demo: \Kastri-master\Demos\NativeControls\WebBrowserOverlay\WBOverlay.dproj a "NativeRectangle" place then it works (only the "NativeRectangle" is shown at the top left, so that's already strange), but in my Project the Project crashes. I've started a new project: -Style: Android -A "NativeRectangle" placed on the form -Fil > Color: Red -Project > Options > Delphi Compiler > Search path: ....\Kastri-master\API ....\Kastri-master\Controls ....\Kastri-master\Core And when I start the Project, I get this error message: Project Test_1.apk raised exception class EJNI with message 'Java type JDWRectangleDrawable could not be found'. What am I doing wrong? If the height or width is slightly icy, it doesn't happen
-
I've gone further, and can now move the mouse cursor in all directions across the entire TWebBrowser, and can catch the OK/Enter key. The next problem is, how can I click something on the TWebBrowser so that it runs?
-
Perfect, I now have a mouse icon (NativeImage) that is displayed on top of the TWebBrowser. I'm now going to try to apply this "NativeImage" in my own App. Edit: It doesn't matter where I put a "NativeImage" on the form, it comes up always to be at the top left, it is of course important that I also do this somewhere Otherwise, insert pan. The only difference I can find is that with "LiveBindings Designer" > Visible Element this is set to True and mine is set to False. And that under Element Layers it says "NativeImage1" Unfortunately, I don't get to stand there. Could that be the problem, and how should I do it?
-
As a start, I use a TWebBrowser and try to put something on it as a corsor. But I can't get both an Image and a Rectangle visible on top of this TWebBrowser. So as 1st how do I get something visible on top of this TWebBrowser ?
-
I do come across some things: https://stackoverflow.com/questions/64350673/how-to-programmatically-include-the-mouse-cursor-in-android-tv But unfortunately nothing for Delphi, and I just understand how I can make this code suitable for Delphi.