辅助功能 API - 将键盘焦点设置到特定元素
使用辅助功能 API,我深入研究一系列元素并找到我感兴趣的特定 AXUIElementRef(全部在外部应用程序中)。如何检查该元素当前是否具有键盘焦点?如果没有,我该如何设置?
类似于使用 AXUIElementSetAttributeValue 将 kAXMainAttribute 设置为 true(这适用于窗口 - 感谢 Peter!)。
PS - 我尝试过 kAXFocusedAttribute,似乎没有完成这项工作。也许它是只读的?
Using the accessibility API, I am drilling down through a series of elements and finding a specific AXUIElementRef I am interested in (all in an external application). How do I check if this element currently has keyboard focus? And if not, how do I set it?
Something similar to using AXUIElementSetAttributeValue to set the kAXMainAttribute to true (this works for a window - thanks Peter!).
PS - I have tried kAXFocusedAttribute, doesn't seem to do the job. Maybe it's read only?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恰恰相反。阅读标题:
在您在窗口焦点(通过将其
kAXFocusedAttribute
设置为 true)。Quite the opposite. Read the header:
Make sure you've activated the application (by setting its
kAXFrontmostAttribute
to true) and made the window key (by setting itskAXFocusedAttribute
to true) before you give a control in the window focus (by setting itskAXFocusedAttribute
to true).