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 5933365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:57:48+00:00 2026-05-22T14:57:48+00:00

I was doing a little research into this, and I found this question. I

  • 0

I was doing a little research into this, and I found
this
question. I implemented the code used there, but nothing happened. Here is the exact code I am using:

.h file

#import <Cocoa/Cocoa.h>


@interface Test : NSView {

}

-(void)keyUp:(NSEvent*)event;
-(void)keyDown:(NSEvent*)event;

@end

.m file

#import "Test.h"


@implementation Test

- (void)keyDown:(NSEvent*)event {
    NSLog(@"A key has been pressed");
    switch( [event keyCode] ) {
        case 126:       // up arrow
        case 125:       // down arrow
        case 124:       // right arrow
        case 123:       // left arrow
            NSLog(@"Arrow key pressed!");
            break;
        default:
            NSLog(@"Key pressed: %@", event);
            break;
    }
}

@end

What is wrong? Is there something that I have to add to the interface?

EDIT: Well, something actually did happen. I my computer beeped at me. Nothing more.

  • 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-22T14:57:49+00:00Added an answer on May 22, 2026 at 2:57 pm

    Implement acceptsFirstResponder:

    - (BOOL)acceptsFirstResponder
    {
        return YES;
    }
    

    Also, make sure that your view is first responder (e.g. by clicking inside the view).

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

Sidebar

Related Questions

I am doing a little research into the feasibility of a project I have
I have been doing a bit of research on this but, I am having
I'm doing a little research on how to cluster articles into 'news stories' ala
I'm planning a web service and doing a little research about what are current
I received the following query from a customer: I am doing some research into
I'm doing a little research in developing a simple socket server that will run
I have a specific task and after doing some research, I feel a little
Been doing some brief research into multithreaded C# event handling because I had a
I'm doing a little research for a server application I'm planning to build. The
I'm doing a little research on possible application of EWS in our existing project

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.