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 21:25:29 -0700
On 2014 Sep 08, at 18:42, Daryle Walker <email@hidden> wrote:
> Using Bindings puts the visibility synchronization code in the best spot, the potentially affected menu items themselves.
I see what you mean.
> The KVO method came to mind first since I didn’t know about menu delegates until later. I guess with the delegate method, I save all the changes with the controllers then apply them all at once at presentation time when -menuNeedsUpdate: (or -numberOfItemsInMenu: and -menu: updateItem: atIndex: shouldCancel:) is called.
Again, I haven’t read your code in detail, but my high-level guess is that maybe you could create, or maybe you already have, a “MenuManager” object that could be interposed between your menu and the data model. It would contain all of the arrays or whatever. On the model side, you could expose bindings (in code) to these five whatever things that can change the data. On the view side, it would be the menu delegate.
> With KVO, menu presentation is standard, since all the applicable items are already in place, reactively done when the WebHistory store changed.
Hey, if you can get Cocoa Bindings working directly on menus, more power to you! I’m just sayin’ that the one time I tried that, I concluded it was all pain and no gain, and quite lonely.
_______________________________________________
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