如何在浏览器或文本编辑器中监视 OSX 上的双击(文本选择)
新手程序员询问关于堆栈溢出的第一个问题。我正在为 mac osx 编写一个应用程序,用于监视文本选择,即当用户双击某些文本时。文本可以来自浏览器或文本编辑器等。目标是捕获文本并对文本进行一些处理。
我一直在阅读有关 mac 库中的鼠标和光标事件的信息,但似乎没有回答我的问题,谷歌搜索让我有点迷失。 http://developer.apple.com/ mac/library/documentation/Cocoa/Conceptual/EventOverview/MouseTrackingEvents/MouseTrackingEvents.html
任何大师都想分享我在哪里可以找到答案吗?任何指导将不胜感激! :)
谢谢你!
Novice programmer asking first question on stack-overflow. I am writing an app for mac osx that monitors for text selection ie when a user does a double click on some text. The text can come from a browser or text editor, etc. The goal is to capture the text and do some processing on the text.
I been reading about the mouse and cursor events in mac library but doesn't seem to answer my questions and googling around leaving me bit lost.
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/EventOverview/MouseTrackingEvents/MouseTrackingEvents.html
Anyone guru want to share where I can find the answer? Any guidance will be appreciated! :)
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法从应用程序监视用户正在使用其他应用程序执行的操作。如果您想提供在其他应用程序中操作所选文本的功能,请使用 系统服务。您所要做的就是提供使用所选文本的函数; OS X 自动执行所有监控、将所选文本传递到您的应用程序等。
从 10.6 开始,系统服务也出现在上下文菜单中。
You can't monitor from an app what the user is doing with some other app. If you want to provide something which manipulates selected texts in other apps, use System Services. All you have to do is to provide the function which consumes the selected texts; OS X automatically does all the monitoring, passing of the selected text to your app etc.
Starting with 10.6, system services also appear in the context menu.