禁用应用程序的全键盘访问 [英] Disable Full Keyboard Access for App
问题描述
可以使用某些 API 控制完整键盘访问"(系统偏好设置 -> 键盘 ->(无线电)所有控件)吗?当这个东西在我的应用程序中打开时它会导致重大问题(比如按钮不能按预期工作等......它有一些自定义用户界面)
Can "Full Keyboard Access" (System Prefs -> Keyboard -> (Radio) All Controls) be controlled with some API? It causes major issues when this thing is on in my app (like buttons not working as expected etc ... it has some custom UI)
问候,埃里克
推荐答案
覆盖自定义视图中的 nextValidKeyView
和 previousValidKeyView
以返回一些理智的东西,或者设置视图的 nextKeyView
和 previousKeyView
到特定视图,如果无法自动检测有效的关键视图.
Override nextValidKeyView
and previousValidKeyView
in your custom view to return something sane, or set the view's nextKeyView
and previousKeyView
to specific views if detecting valid key views automatically isn't possible.
如果全键盘访问无法正确导航您的应用,那么任何不会使用鼠标的人也无法正确导航.此外,我们中的一些人真的很喜欢全键盘访问,并且讨厌任何在其下无法正常工作或故意破坏它的应用程序(并且,从用户的角度来看,没有区别).
If Full Keyboard Access can't navigate your app correctly, then neither can anybody who can't use the mouse. Also, some of us really like Full Keyboard Access, and hate any app that either doesn't work properly under it or breaks it deliberately (and, from the user perspective, there is no difference).
这篇关于禁用应用程序的全键盘访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!