• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting keyDowns
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting keyDowns


  • Subject: Re: Getting keyDowns
  • From: Rosyna <email@hidden>
  • Date: Sun, 26 Aug 2001 11:59:57 -0700

I have it set up as so.

#import "KeyHandler.h"

@implementation KeyHandler

-(void)keyDown:(NSEvent*)event
{
NSLog(@"Hi");
}

-(void)awakeFromNib
{
[window makeKeyAndOrderFront:nil];
NSLog(@"Ho");
}

@end

In the nib I have a connection from the window to the delegate outlet in the KeyHandler class. this and a disabled text field is all thats on the window. Pressing keys just makes it beep. And this is all the project consist of, and Ho is shown so it does see the class.

Ack, at 8/26/01, John C. Randolph said:

On Sunday, August 26, 2001, at 11:37 AM, Rosyna wrote:

Does anyone know of any sample code to get keyDowns in an application? (a window specifically)

I don't know about sample code, but all you need to do is implement -keyDown:(NSEvent *) theEvent in your window delegate. If nothing else in the responder chain takes the keys, you'll get them.


-jcr

[Objc retain];

--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insane People


  • Follow-Ups:
    • Re: Getting keyDowns
      • From: "John C. Randolph" <email@hidden>
    • Re: Getting keyDowns
      • From: John Stringham <email@hidden>
References: 
 >Re: Getting keyDowns (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: NSThread
  • Next by Date: Re: Getting keyDowns
  • Previous by thread: Re: Getting keyDowns
  • Next by thread: Re: Getting keyDowns
  • Index(es):
    • Date
    • Thread