• 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
[newbie] access the controller for the current window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[newbie] access the controller for the current window


  • Subject: [newbie] access the controller for the current window
  • From: Barry McClure <email@hidden>
  • Date: Wed, 17 Aug 2005 15:40:29 -0700 (PDT)

I subclassed NSTableView to capture keydown events.
The method that i want fired when a certain key is
pressed is in the controller class for application. It
doesn't fire the method.

someController (in the following code) is nil.  What
have I done wrong?

Thanks for anyhelp.
Barry

<snip>

-(void)keyDown:(NSEvent *)theEvent {
    unichar key = [[theEvent
charactersIgnoringModifiers] characterAtIndex:0];

    if (key == NSDeleteCharacter && [self
numberOfRows] > 0 && [self selectedRow] != -1)
    {
        id Window = [self window];
        if (Window == nil)
        {
            NSRunAlertPanel(@"Something's
wrong",@"window is nil",@"OK",@"Cancel",nil);
        }
        id someController = [[self window]
windowController];
        if (someController == nil)
        {
            NSRunAlertPanel(@"Something's
wrong",@"controller is nil",@"OK",@"Cancel",nil);
        }
        [someController deleteLDAPAttribute:self];
    }
    else
    {
        [super keyDown:theEvent];
    }
</snip>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [newbie] access the controller for the current window
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: CoreData based document NSUndoManager troubles
  • Next by Date: Re: [newbie] access the controller for the current window
  • Previous by thread: Setting default font for NSTextView in IB?
  • Next by thread: Re: [newbie] access the controller for the current window
  • Index(es):
    • Date
    • Thread