Rol*_*sow 6 delphi macos firemonkey
在Firemonkey 2(FMX2)中有接口
IFMXMouseService = interface(IInterface)['{2370205F-CF27-4DF6-9B1F-5EBC27271D5A}']
该接口只有一个GetMousePos函数.但是如何以跨平台方式设置鼠标位置?任何人的想法?
我提出的最好的想法是做一个条件编译,直到FMX中存在可能性 - 但我不知道如何通过Delphi为MACOSX设置鼠标位置.我会感谢任何帮助.
这是您需要的程序。您必须将 macapi.coregraphics 和 macapi.cocoatypes 添加到您的 use 子句中。
procedure setmousepos(x,y:single);
var aNSPoint:NSPoint;
begin
aNSPoint.x:=x;
aNSPoint.y:=y;
CGWarpMouseCursorPosition(aNSPoint);
end;
Run Code Online (Sandbox Code Playgroud)
您当然可以传递 TPointF 来代替 X,Y,但您仍然需要分别设置 NSPoint X 和 Y,因为 NSPoint 与 TPointF 不同。
问候
Dave Peters
DP 软件
www.dpsoftware.com/firemonkey
| 归档时间: |
|
| 查看次数: |
1042 次 |
| 最近记录: |