• 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: Handling keydown events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling keydown events


  • Subject: Re: Handling keydown events
  • From: Carlos Weber <email@hidden>
  • Date: Sat, 24 Nov 2001 11:36:18 -1000

On Saturday, November 24, 2001, at 07:06 , Paolo Caturegli wrote:

Hello I'm new to the list (and to cocoa too).

I need to handle keydown events from my app.

Following what "Learning Cocoa" book states I've create a controller (NSObject) for my (MVC) application using IB and making the correct wiring there. The application works fine.

From inside the controller I would like to intercept keydown events before they get passed to the only window I use.

I overrided the defs for both sendEvent & keyDown (this because sendEvent do not work) but there is no way to get into the code I've inserted in the overrided sendEvent (or KeyDown): the app build up fine but simply ignore my (both) override.

What I'm missing? Reading chap 8 of the book seems I'm doing the correct action.
Can an NSObject use NSResponder methods such sendEvent, keyDown or mouseDown directly or I have to do something else?

Notice that the DotView code in ch. 8 of the Learning Cocoa book overrides the - mouseUp: method in a subclass of NSView, which inherits from NSResponder. You can't override these methods in an NSObject subclass. Check out the documentation for NSResponder, which describes how event messages are dispatched (from the WindowServer to NSApplication to the active NSWindow to its firstResponder and thence to each subsequent responder in the chain until someone handles the event).


References: 
 >Handling keydown events (From: Paolo Caturegli <email@hidden>)

  • Prev by Date: NSArchiver/NSUnarchiver + Java: Does this work?
  • Next by Date: poseAsClassing???
  • Previous by thread: Handling keydown events
  • Next by thread: EO- classes in ObjC, (was Java Question - getting access to protected methods...)
  • Index(es):
    • Date
    • Thread