Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
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.

Key Equivalent In IB Doesn't Seem To Work?

ChrisYatesChrisYates Posts: 325Registered Users
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.
Post edited by ChrisYates on

Replies

  • LinusRLinusR Posts: 17Registered Users
    ChrisYates;435002 said:
    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?

    Hope that helps :)

    Have a nice day,

    Linus
  • ChrisYatesChrisYates Posts: 325Registered Users
    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.
  • LinusRLinusR Posts: 17Registered Users
    ChrisYates;435066 said:
    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.

    Hope that helps.

    Have a nice day and good luck,

    Linus
  • ChrisYatesChrisYates Posts: 325Registered Users
    Oh right, so that's clearly why it doesn't work. Thanks for that I'll search for global hotkeys, thanks again Linus...really helpful. :D
Sign In or Register to comment.