Re: Add bindings for custom menu items' isHidden to (an attribute of) a custom object?
Re: Add bindings for custom menu items' isHidden to (an attribute of) a custom object?
- Subject: Re: Add bindings for custom menu items' isHidden to (an attribute of) a custom object?
- From: Jerry Krinock <email@hidden>
- Date: Mon, 08 Sep 2014 12:55:32 -0700
Daryle, allow me to admit that I have not read much of your posts. I’m just going to give some general advice.
Cocoa Bindings can be problematic, but the problems are worth it when they solve the otherwise-difficult problem of magically keeping a data model and view in sync. In the case of NSMenu and NSMenuItem, however, there is no difficult problem because the menu is only visible when the user clicks on it, and at that time the delegate method -menuNeedsUpdate: is invoked, in which you can update the menu to reflect the current state of the model. In the other direction, the only time that the menu can change the model is when a menu item is clicked, and at that time you get an action message sent to a target.
It looks like you’ve written a lot of code there. You should ask yourself what you are trying to do with Cocoa Bindings that you could not do by setting a delegate, implementing -menuNeedsUpdate:, and defining targets and actions. Cocoa Bindings of menus are probably more problematic than are Cocoa Bindings of normal view-based controls, because menus work differently. Also, menu bindings may be more buggy since they are rarely used and thus rarely tested.
_______________________________________________
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