• 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
another best-practices question: separate delegates for controls?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

another best-practices question: separate delegates for controls?


  • Subject: another best-practices question: separate delegates for controls?
  • From: "Brian Williams" <email@hidden>
  • Date: Wed, 12 Nov 2008 10:03:03 -0500
  • Thread-topic: another best-practices question: separate delegates for controls?

Hello,



It seems that it could be dangerous (from a maintenance point-of-view)
to use one object as the delegate for multiple controls.  As new
controls/delegate methods are added, it seems possible that you could
inadvertently break existing control functionality.



For example, it seems that NSMenus check for the existence of method
menuNeedsUpdate: only in the case that numberOfItemsInMenu: and
menu:updateItem:atIndex:shouldCancel: are not implemented.  So if I used
the first delegate for my first menu, then later added a second menu
using the latter delegates, I've just broken my first menu.



Seems the best practice would be to make a separate delegate for every
control type (or at least related control types) and establish some type
of data exchange mechanism (read: "global pointer") between the delegate
object and the controller object that has all the data I need.



Or is there some way to say 'this delegate method is only appropriate
for the following inputs' ?



-Brian





_______________________________________________

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

  • Prev by Date: Cora Animation transormation
  • Next by Date: Re: Cora Animation transormation
  • Previous by thread: Re: Cora Animation transormation
  • Next by thread: Not turning off back light
  • Index(es):
    • Date
    • Thread