문제

In Xcode, when you are setting a keyboard shortcut, there is a nice control that helps you out:

UI Control

I feel like I could reproduce it by extending a NSTextField, but I also feel like it may be something someone else has done before. I've done some searching but have not been able to come up with anything.

Does anyone happen to know where I may find a similar component, or possibly have any suggestions should I attempt it myself?

도움이 되었습니까?

해결책

Thanks to another post, I found ShortcutRecorder. Basically what I was looking for.

다른 팁

Yes samething you can do in the textfield as well:-

  1. You have to make button programmatically inside that set keyEquivalent there.

  2. Set action and target programmatically inside button.

  3. Inside method set your textfield to be becomeFirstResponder. So that whenever user press shortcut your textfield will be selected.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top