Focus ring on NSPopupButton doesn't appear on pressing tab
-
25-06-2021 - |
Вопрос
I have a couple of NSPopupButtons
on my view and they are defined as a newKeyView
after one of the text fields. The problem is that somehow they are not getting the focus ring when pressing the tab button comes to them, like they are ignored. What should be done in order for them to get a focus ring?
Thanks,
Nava
Решение
The default behavior in OSX is to only have certain controls be navigable by the tab key. You can change this in the keyboard preferences pane in System Preferences. In the Keyboard Shortcuts tab, select the "All controls" radio button.
Другие советы
You can create a subclass of NSPopupButton and override method canBecomeKeyView, returning YES. My code using python:
class ComboBox(AppKit.NSPopUpButton):
def canBecomeKeyView(self):
return True
Не связан с StackOverflow