Re: Kludges when binding to 'value' of Menu Items
Re: Kludges when binding to 'value' of Menu Items
- Subject: Re: Kludges when binding to 'value' of Menu Items
- From: Jerry Krinock <email@hidden>
- Date: Wed, 17 Oct 2007 04:53:51 -0700
On 2007 Oct, 16, at 10:52, I. Savant wrote:
Maybe it's best if you back up and explain exactly what you're
trying to accomplish and how things are set up in your project (code
as well).
I'm trying to get the job done. Let's move on...
I use the mainWindow.windowController.document.whatever
approach quite frequently for inspector palettes and such. As long as
everything is 100% KVC/KVO compliant
Yes, I tried another menu item and yes it did work, but I have no
idea where to begin on the errors with the other item that I reported
yesterday.
and every document type "handles"
the bound key (even if it's a dummy), it works perfectly for me.
Yes, that was another thing I was worried about but hadn't got there
yet.
Granted, I've never used it in conjunction with menu items. It's
always just been easier to use the validation methods and
-menuNeedsUpdate: ...
The above is the real answer. What I've learned:
Unless you're working on a science project and want to be the first
to discover obscure bugs because you're doing something few people
have done, don't use the 'value' binding in NSMenuItem. Finding bugs
is particularly thankless as an OS version is about to become
obsolete ;) Use menuNeedsUpdate: etc instead. Simpler, you get
compiler warnings, and when you consider all the will/
didChangeValueForKey and redundant accessors that are become
necessary to "support" bindings, the number of code lines is comparable.
So I ripped out all the bindings, did it the old way and now
everything works. Thanks again, I.S., and also D.S. who replied
privately.
Jerry Krinock
_______________________________________________
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