Re: Please help. At wit's end binding NSPopupButtonCell selection
The 'anIndex' in my snippet is just nothing - you'd have to determine that. I guess it would be something like the selected object index of the array controller you're binding the popup's content to? As for whether or not it's possible to do this with bindings, I'm not 100% sure... When the table is first displayed, are the proper selections displayed for each row? Does this problem only come up when you change the selection selection in one of the pop up cells? On Nov 4, 2008, at 11:49 AM, Ken Tozier wrote: Hmmm. So there's no way to set this up just through bindings? Also, in your snippet, where does anIndex come from? On Nov 4, 2008, at 5:32 AM, Cathy Shive wrote: On Nov 4, 2008, at 10:05 AM, Ken Tozier wrote: What happens is that when I choose an item in one row's popup cell, the selection in every popup in the entire table changes to the new selection. Don't forget that there is only one NSPopUpButtonCell per column. If you change it's selection, it's actually correct that when the table redraws, the other rows will redraw to show the new selection. Basically - If you have 5 rows, it appears that there are 5 different popup menus, but really, there is one that has been drawn 5 times at different locations. The table view tells you when it's about to draw a cell and you can set the correct selection of your popup cell here. All you need to do is implement the delegate method: - (BOOL)tableView:(NSTableView *)theTableView willDisplayCell: (id)theCell forTableColumn:(NSTableColumn*)theTableColumn row: (int)theRowIndex { if([[theTableColumn identifier] isEqualToString:@MyPopUpButtonColumn]) [theCell selectItemAtIndex:anIndex]; } HTH, Cathy ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/catshive%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Please help. At wit's end binding NSPopupButtonCell selection
On Nov 4, 2008, at 7:07 AM, Cathy Shive wrote: As for whether or not it's possible to do this with bindings, I'm not 100% sure... When the table is first displayed, are the proper selections displayed for each row? Yes and no. The popups have all the correct choices in them but all pages in the project group are set to the correct choice for the first page. Does this problem only come up when you change the selection selection in one of the pop up cells? Yes. When I select a new master page option, every other page in the group instantly changes to the same selection. The reason I think this might be possible through bindings, is that other bound fields in the table have values specific to their associated page. For example, pages also have a status string, indicating whether stories need trims, are missing photos etc and these are populated correctly with the following binding [pageController bind: @contentArray toObject: inProject withKeyPath: @childNodes options: nil]; [statusColumn bind: @value toObject: pageController withKeyPath: @arrangedObjects.status options: nil]; ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Please help. At wit's end binding NSPopupButtonCell selection
On Nov 4, 2008, at 10:05 AM, Ken Tozier wrote: What happens is that when I choose an item in one row's popup cell, the selection in every popup in the entire table changes to the new selection. Don't forget that there is only one NSPopUpButtonCell per column. If you change it's selection, it's actually correct that when the table redraws, the other rows will redraw to show the new selection. Basically - If you have 5 rows, it appears that there are 5 different popup menus, but really, there is one that has been drawn 5 times at different locations. The table view tells you when it's about to draw a cell and you can set the correct selection of your popup cell here. All you need to do is implement the delegate method: - (BOOL)tableView:(NSTableView *)theTableView willDisplayCell: (id)theCell forTableColumn:(NSTableColumn*)theTableColumn row: (int)theRowIndex { if([[theTableColumn identifier] isEqualToString:@MyPopUpButtonColumn]) [theCell selectItemAtIndex:anIndex]; } HTH, Cathy ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Please help. At wit's end binding NSPopupButtonCell selection
Success! Here's the correct incantation 1. bind page controller to page list [pageController bind: @contentArray toObject: inProject withKeyPath: @pages options: nil]; 2. bind popup controller to master page list [popupController bind: @contentArray toObject: inProject withKeyPath: @masters options: nil]; 3. bind popup column to pageController and popupController [popupColumn bind: @content toObject: popupController withKeyPath: @arrangedObjects options: nil]; [popupColumn bind: @contentValues toObject: popupController withKeyPath: @arrangedObjects.name options: nil]; [popupColumn bind: @selectedValue toObject: pageController withKeyPath: @arrangedObjects.master options: nil]; Thank you so much Cathy. You're a life saver :) -Ken On Nov 4, 2008, at 7:38 AM, Cathy Shive wrote: It is possible: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html Look at the To Dos example project. Seems like a similar setup: Shows two array controllers, one to manage the contents of a table view, the other to manage a pop-up menu in a table column. I think this can help you get it working :) - c ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]