• 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: activating Delete menu item through binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: activating Delete menu item through binding


  • Subject: Re: activating Delete menu item through binding
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 16 Apr 2012 16:34:43 -0700

On Apr 16, 2012, at 16:18 , Koen van der Drift wrote:

> Still a bit confused here. My tableview from which I want to delete
> items is controlled by an NSViewController, and populated by an
> NSArrayController that is again hooked up to my CoreData model.

Yes, that's an awkward case. Although a NSViewController *is* a responder, it *isn't* automatically added to the responder chain. Therefore it cannot be found as first responder, and so its action method is not recognized by menu validation. :)

You can manually add the view controller to the responder chain if you want, in loadView perhaps. However, I've never quite figured out all the places where I'd need to manually remove it again. (If you're not swapping views, then maybe you don't need to worry about that -- just leave it there until the responder chain gets pruned in the normal course of events.)

Otherwise, you have to move the validation code to the window controller (or whatever object can receive the validation request), *and* put a duplicate 'delete:' action method in the window controller, *and* have it call the view controller's 'delete:' method.

Another alternative might be to implement 'delete:' in the view itself (if you can use/are using a custom view subclass), and delegate both the validation and the invocation to the view controller.

Sorry, I don't know of a cleaner way. Maybe someone else will jump in with an improved solution.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: activating Delete menu item through binding
      • From: Koen van der Drift <email@hidden>
References: 
 >activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)
 >Re: activating Delete menu item through binding (From: Quincey Morris <email@hidden>)
 >Re: activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)
 >Re: activating Delete menu item through binding (From: Quincey Morris <email@hidden>)
 >Re: activating Delete menu item through binding (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: Resizing UITableView will keeping content scrolled to bottom
  • Next by Date: Re: Fast Enumeration and temporary objects/autoreleasing
  • Previous by thread: Re: activating Delete menu item through binding
  • Next by thread: Re: activating Delete menu item through binding
  • Index(es):
    • Date
    • Thread