Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
In IB under the Attributes Inspector there's an option for a button which says 'Key Equivalent'. When I add something there such as CMD+AnyKeyboard Letter as a shortcut to activate that button method nothing happens when I test my app. I've tried all sorts of combinations without success.
Any ideas why this wouldn't work?
Basically I'm just trying to allow the user to enter a keyboard shortcut to open a window.
In IB under the Attributes Inspector there's an option for a button which says 'Key Equivalent'. When I add something there such as CMD+AnyKeyboard Letter as a shortcut to activate that button method nothing happens when I test my app. I've tried all sorts of combinations without success.
Any ideas why this wouldn't work?
Basically I'm just trying to allow the user to enter a keyboard shortcut to open a window.
Do you use a button (NSButton)? Is it hidden? If it is, unhide it. Hidden buttons can't be chosen by the user, also not by a key equivalent. Do you use an NSMenuItem? If no NSButton works, try the NSMenuItem. This should work in every case. Is the method of the button connected?
Hi Linus, thanks again for the reply. I'll give it another go but I'm convinced it doesn't work. Basically my app is a menubar app. Although it's available in the background it's not in view so my intention was to use a keyboard shortcut to bring up a window when necessary.
Hi Linus, thanks again for the reply. I'll give it another go but I'm convinced it doesn't work. Basically my app is a menubar app. Although it's available in the background it's not in view so my intention was to use a keyboard shortcut to bring up a window when necessary.
Does that mean, that your app isn't always the frontmost one? Then it's no wonder that your shortcut doesn't work. Shortcuts do only work when the app they belong to is the front most application. To use global shortcuts, and I think that is what you want, google for "global hotkeys cocoa" or something like that. To achieve what you want, you have to use code parts of C. But there are some nice tutorials on that.
Replies
Hope that helps :)
Have a nice day,
Linus
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeHope that helps.
Have a nice day and good luck,
Linus
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome