Turan Can 3 Posted November 24, 2021 Hi All, Does anyone know the equivalent of these 2 features in android? I want to click on the X, Y coordinates I sent. Windows vcl; I've been using these on windows with no problems. SetCursorPos Mouse_Event Android ?? event: JMotionEvent; Form1.MouseMove([], Mouse.Left, Mouse.Top); Share this post Link to post
Guest Posted November 26, 2021 On 11/25/2021 at 12:20 AM, Turan Can said: Hi All, Does anyone know the equivalent of these 2 features in android? I want to click on the X, Y coordinates I sent. Windows vcl; I've been using these on windows with no problems. SetCursorPos Mouse_Event Android ?? event: JMotionEvent; Form1.MouseMove([], Mouse.Left, Mouse.Top); hi, its usage is shown below, it would be better if you add a short pause between mouse down and up event (sleep(ms)). if your question is to click somewhere on the android screen rather than in the form (for example running as a background service) this will not work. http://git.kngstr.com/KngStr/delphi-fixes/src/b80b30a708f89ee5e1bbc457af248e69869a2ad4/10.3.1/Fixes/FMX.Presentation.Android.pas if EventAction = TJMotionEvent.JavaClass.ACTION_DOWN then begin Form.MouseMove([ssTouch], TouchPoint.X, TouchPoint.Y); Form.MouseMove([], TouchPoint.X, TouchPoint.Y); // Require for correct IsMouseOver handle Form.MouseDown(TMouseButton.mbLeft, [ssLeft, ssTouch], TouchPoint.x, TouchPoint.y); end else if EventAction = TJMotionEvent.JavaClass.ACTION_MOVE then begin ProcessMoveActiveGestures; Form.MouseMove([ssLeft, ssTouch], TouchPoint.x, TouchPoint.y) end else if EventAction = TJMotionEvent.JavaClass.ACTION_CANCEL then begin FinishActiveGestures; Form.MouseUp(TMouseButton.mbLeft, [ssLeft, ssTouch], TouchPoint.x, TouchPoint.y, False); // In MouseUp the form can unload presentation! if Form <> nil then Form.MouseLeave; end else if EventAction = TJMotionEvent.JavaClass.ACTION_UP then begin FinishActiveGestures; Form.MouseUp(TMouseButton.mbLeft, [ssLeft, ssTouch], TouchPoint.x, TouchPoint.y); // In MouseUp the form can unload presentation! if Form <> nil then Form.MouseLeave; end; Share this post Link to post
Turan Can 3 Posted November 30, 2021 First of all thanks for the reply. This only works in the open form. I want to activate the mouse anywhere on the phone. Share this post Link to post
Turan Can 3 Posted December 1, 2021 Mouse, Detection of mouse click I need a sample code to post mosu as x, y. Important: I want to click outside the form globally, not on the form. So even if the form is running in the background, I want to click on a point I want. function MousePos: TPointF; var MouseService: IFMXMouseService; begin if TPlatformServices.Current.SupportsPlatformService(IFMXMouseService, IInterface(MouseService)) then Exit(MouseService.GetMousePos); Result := PointF(0, 0); end; Share this post Link to post
Lars Fosdal 1792 Posted December 1, 2021 Not sure that is possible as such functionality could violate security. Share this post Link to post
Turan Can 3 Posted December 1, 2021 This has to be. Because remote desktop connection products will not work otherwise. It has to be active with an authorization. Share this post Link to post
Lars Fosdal 1792 Posted December 2, 2021 The RD runs as a UI-less service, right? So it doesn't have a Window of its own and probably have special rights to capture the display activities and send events. Share this post Link to post