質問

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