문제

I want to have a button which allows the user to pick a global hotkey. I stumbled upon stackoverflow and found some ways to register a hotkey, but none which allows me to let the user pick one. Is there maybe a library for it? Or how you guys handle this?

It should look like this:

enter image description here

도움이 되었습니까?

해결책

If you would like to use an already existing framework, Shortcut Recorder is a good one that is used often. It's pretty easy to use, and might suit your needs. You can also do this manually, as alfred has mentioned, but it's quite a bit more work this way.

다른 팁

You may just create an Event Tap and register keys pressed by the user. When the callback function gets called you'll have enough information to know exactly what keys has been pressed. Then you should just update the string value.

Or, at least, that's the way I'd do it.

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