My web-browser app makes menu items with paired submenus for each day that has 
WebHistoryItem instances. It’s done with a custom coordinator object that 
publishes a KVO-compliant array, each element a menu item with a submenu. I 
made another coordinator object to handle Today’s history items. I set it’s 
source-menu attribute to one of the day menu-items, and it publishes two 
KVO-compliant arrays. The first array holds copies of the source menu’s items 
up to a limit, the second array holds copies of the remaining menu items. (The 
limit is also an attribute.) Note that these menu items arrays are read-only 
from the outside.

Right now, the menu item that holds the submenu where the overflow menu items 
go is always visible. I was thinking of controlling its visibility with Cocoa 
Bindings. I select the menu item in the Interface Builder part of Xcode, go to 
the Bindings Inspector, reveal the Hidden attribute settings, and set the 
binding to my app’s delegate. Under the Model Key Path, I put 
“self.my2ndCoordinator.overflowArray”. Now, that’s an array and I need a 
Boolean. I tried “.count” and “.@count” at the end, and neither worked. How do 
I get that part to work? Even then, I still need to stick in the “> 0” part 
somewhere (unless Bindings does the zero vs. non-zero to Boolean conversion C 
does). What about that? Or do I have to go indirect and use something like an 
NSArrayController?

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to