Reputation: 2603
I am Trying to convert some code from delphi to firemoneky but come across something i am unsure how to do in firemoneky.
SetCursorpos
setcursorpos(p.x,p.y);
Any idea on how to do this in firemonkey?
i have tried game.SetCursor(p.x,p.y);
but it doe not like it says setcursor is undefined.. Also did add fmx.plateform to my uses list.
Upvotes: 1
Views: 2060
Reputation: 1
I found something, but it works only with windows: - You need to make a DATAmodule - Set the type of it to VCL (This is possible for me because i'm using delphi XE 10.1) - Add the Windows unit to the uses - Make a procedure in the DataModul like this
`procedure TMouseController.SetCursorPosition(x, y: integer);`
begin
SetCursorPos(x, y);
end;
end.
-And then use this in the program like this:
`procedure TMainForm.Form3DShow(Sender: TObject);
var
Center: TPoint;
begin
Center.SetLocation(Screen.Width div 2, Screen.Height div 2);
MouseController.SetCursorPosition(Center.X, Center.Y);
end;`
Upvotes: 0
Reputation: 613592
There is no call to the SetCursorPos
Win32 API function in the XE2 FMX source code. From which I conclude that nothing in the FMX framework encapsulates that functionality.
You'll need to call SetCursorPos
directly in your Windows FMX projects. If you are targeting other platforms then you'll need to call the appropriate API for that platform.
Upvotes: 1