To bind or not to bind(ings)
To bind or not to bind(ings)
- Subject: To bind or not to bind(ings)
- From: Kam Dahin <email@hidden>
- Date: Fri, 15 Sep 2006 10:43:33 -0700
Hi All,
Looking for some advice here.
I have a NSTableView with a number of NSPopUpButtonCell's that I have
bound to various array controllers for data. I want to be able to
organize the menu's, add actions on item selection and be able to put
in NSMenuItem separators. I have been trying to make this work using
bindings and the tips from mmalc's site on mixing dynamic content
with static content, and I have the basics sorta working.
I have also experimented with using a delegate on my NSMenu's and
calling the -(void)menuNeedsUpdate:(NSMenu *)menu delegate method to
organize and update my NSMenu's. I have followed this article to
make this happen:
http://www.corbinstreehouse.com/blog/?p=22
If I go with the bindings approach, I lose the ability to organize
the menu (like adding separators, categories for organization, and
menuitem indentation. It is also a real challenge to have the name
of the menu items show up correctly in the menu. I do get the ability
to add the selected menu item to my model object and each
NSPopUpButtonCell in my table behaves correctly.
If I go with the delegate approach, I get all of the organization
abilities, but I lose the ability to have the selected item added to
my model object. I also seem to get erratic menu behavior where when
I change a menu item in one cell's NSPopUpButtonCell, it changes the
value in another. In other words, the changes I make don't seem to
be affecting the whole column and not just in individual cell.
What I am hoping is that someone could point me in the best direction
for creating dynamic menu's that have static items in my
NSTableView. I would like to be able to organize and indent my menu
items, have my selection in the menu trigger an action, be able to
add new items to my menu and have the selection's represented object
set in my model. It seems that I can go one route or the other. I
am new to Cocoa, so I am probably missing something obvious but I was
hoping that if someone has had success doing this sorta thing, that
the would be willing to point me in the right direction? I have been
able to do a great deal with Bindings in my project, but this
particular aspect of my application has been a real problem spot.
Regards,
Kam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden