Jump to content

MMSoft

Members
  • Content Count

    21
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. MMSoft

    Request "Access All Files" Permission ?

    Thanks, it works ! (I had been looking for it for days).
  2. 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)
  3. MMSoft

    Mouse cursor

    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
  4. MMSoft

    Mouse cursor

    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;
  5. MMSoft

    Mouse cursor

    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.
  6. MMSoft

    Mouse cursor

    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'.
  7. MMSoft

    Mouse cursor

    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
  8. MMSoft

    Mouse cursor

    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
  9. MMSoft

    Mouse cursor

    Unfortunately, nothing is happening yet
  10. MMSoft

    Mouse cursor

    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.
  11. MMSoft

    Mouse cursor

    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.
  12. MMSoft

    Mouse cursor

    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.
  13. MMSoft

    Mouse cursor

    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 ?
  14. MMSoft

    Mouse cursor

    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?
  15. MMSoft

    Mouse cursor

    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.
×