On Jan 20, 2010, at 8:30 PM, Evan Schoenberg wrote:

> I copied the keyDown method from Cocoa in a Nutshell, by the way. Needless to 
> say, I don't really understand it.  Basically, I would love it if somebody 
> could help me to get this program to work, because as of yet I have not 
> gotten anything to respond to keystrokes.  I believe that I need to make 
> Input the First Responder, but I'm not sure about that and I don't know how 
> to anyway...

You also need to tell Cocoa that your view can accept keyboard focus:

- (BOOL)canBecomeKeyView {
        return YES;
}

And in your nib you want to wire the window's "initialKeyView" outlet to your 
view, so it'll be key by default.

Finally, The keyDown: method increases the length value, but it doesn't trigger 
a redraw of the view so this won't have any visible effect. After increasing 
length you need to call
        [self setNeedsDisplay: YES];
which tells the window that your view should be redrawn ASAP.

—Jens

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to