Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6607805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:32:33+00:00 2026-05-25T19:32:33+00:00

I have a button on my window that is set in interface builder to

  • 0

I have a button on my window that is set in interface builder to have the key equivalent of enter, but after switching a content view from using IKImageBrowserView to NSCollectionView, the keyEquivalent is being ignored.

From what it says in the docs:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW10

The keyEquivalent events are handled “special” and should be pretty straight forward.

I am subclassing the NSCollectionViewItem and the view of the item but neither of these subclasses are getting the performKeyEquivalent:theEvent when I override that method.

There is a cancel button right next to the default button and is mapped to the esacpe key. Cancel continues to work, but the default button does not.

How can I tell where the enter key event is getting handled?

Edit:

I actually found the same issue in the sample app that I used to learn about NSCollectionView. I added a default button to the bottom of the window and found that return did not trigger the button but enter (fn + return) did trigger the button.

IconCollection sample app from Apple

Any ideas on what is stealing the return key event in this example?

Edit:

I posted a sample project here: https://github.com/watkyn/NSCollectionViewIssue. Why doesn’t the default button work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:32:33+00:00Added an answer on May 25, 2026 at 7:32 pm

    Return and Enter are two different keys. Return (on a US keyboard) is to the right of the apostrophe key. Enter is the lower-right key on the keypad. If you are using a laptop without a numeric keypad, you get Enter by pressing fn+Return.


    Edit after sample code was posted

    MyCollectionView is absorbing the return/enter keystroke and not passing it up the responder chain. Add this to the implementation of MyCollectionView and return and enter will press the button:

    - (void)keyDown:(NSEvent *)theEvent {
    //  NSLog(@"event: %@", theEvent);
        if (36 == theEvent.keyCode || 76 == theEvent.keyCode) {
            //pass return and enter up the responder chain
            [[self window] keyDown:theEvent];
        }
        else {
            //process all other keys in the default manner
            [super keyDown:theEvent];
        }
    }
    

    This may cause problems if you need MyControllerView to actually do something itself with return/enter. In that case, you can add [super keyDown:theEvent] before [[self window] keyDown:theEvent].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a button in my window such that if I
I have a button that opens a panel in a popup window and then
I have a Switch to window button on my main form that I'd like
I have a login window with a Sign In button which is set as
I have a UINavigationController that I've set as the rootViewController of my window. In
I have an iphone app that has a root view with a button that
I have made a window with an NSOpenGLView that I am rendering openGL content
I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have a button on the window form and and one method I am
I have a button with a transparent background on a wpf window. Problem is,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.