模拟按键事件
如何在执行其他代码时模拟按住某个键(ctrl)?下面的方法的实现是什么?
self ctrlDownWhile: [self doSomething]
How can I simulate a key (ctrl) being hold down while some other code is executed? What would be the implementation of the following method?
self ctrlDownWhile: [self doSomething]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试通过更改其“ctrlDown”状态来“欺骗”输入状态。
坏消息是它没有 setter 方法来访问它(可能仅在我的版本中),因此您可能需要使用一个技巧:
另一种方法是创建 keyPress & 。 CTRL 键的 keyRelease 事件,并在块评估之前和之后将它们排队到 WindowSensor 中。
You could try to "trick" the input state, by changing its "ctrlDown" state.
The bad news is that it does not have a setter-method to access it (maybe only in my version), so you may have to get there with a trick:
an alternative is to create keyPress & keyRelease-events for the CTRL-key, and enqueue them into the WindowSensor, before and after the block's evaluation.