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.
How to accept keyboard input in a menubar app?
I have created a menubar app and it all works fine but what I can't seem to figure out is how to allow the user to use the keyboard to enter numbers into the menubar app, I've tried to set the keyboard equivalent in IB but it just ignores the input?
I'm hazarding a guess that it might have something to do with setting the focus on the app when it's in view?
Essentially it's just a calculator so I wish to allow the user to use their number keypad to do the calculations.
Any help would be much appreciated.
0 •
Replies
there is a known bug in Lion with Popovers in menu bars not accepting keyboard input.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI thought this might be because it recognises the drop down window as a menu so will ignore any other menu and it's keyboard equivalents so I tried a test with Safari. If I click on the 'File Menu' in Safari and then use an 'Edit Menu' keyboard equivalent such as 'Select All' it responds perfectly even though the 'File Menu' is open.
This let's me know it can be done but I have no idea why it's ignoring my keyboard equivalents when the app is showing.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action
The menu receives your keyboard event, and you return YES for your bare keys. Then in your NSMenu subclass you would implement - (BOOL)performKeyEquivalent:(NSEvent *)theEvent to actually handle the key.
If that's what you're already doing, then I'm not sure what to try next!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome