• 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
-keyDown and Category problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-keyDown and Category problem


  • Subject: -keyDown and Category problem
  • From: Yuki Nishida <email@hidden>
  • Date: Sat, 22 May 2004 13:06:06 -0400

Hi,

I am trying to make my application receives keyDown events as well as
key-equivalents such as Command-D (my custom action).
I did a search in the archives and one post suggested that I add a
category to NSWindow, with the method -keyDown, like this:

@implementation NSWindow (MyEvents)

- (void)keyDown: (NSEvent *)event
{
unichar unicodeKey;
unicodeKey = [[event characters] characterAtIndex: 0];

switch(unicodeKey)
{
case NSUpArrowFunctionKey:
[[mainWindowController myView] rotateUp];
break;

// etc.
}
}

@end

But my problem is that I need access to my mainWindowController for the
openGLView, called myView,
which takes user input and performs actions. Since I can't add instance
variables to a category, how can I achieve this?

My former way of receiving keyDown events was to makeFirstResponder my
(I think it was) mainWindowController, and put
-keyDown in there. But then my Command-D menu action doesn't get
called, even though I do receive KeyDown events.

Either way, I'm stuck and could use your help.

Thanks,

-Yuki
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: NSOpenGLView in not shown tab
  • Next by Date: Re: NSTableView and NSArrayController
  • Previous by thread: Re: smysl bundled
  • Next by thread: Re: Export panel like iPhoto (Solved)
  • Index(es):
    • Date
    • Thread