Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings: changing model changes some views but not others (NSTableColumn)



On 2006-11-29 13:57, Scott Stevenson said:

>> I have an NSTableColumn bound like so:
>>
>> bind to: AppController (NSObject subclass instantiated in the nib)
>> controller key: n/a
>> model key path: polarisMaster.polaris
>> ControlsController.selection.toolsController.arrangedObjects.name
>
>Have you tried binding to an array controller directly in the NIB?

Scott, you are definitely on to something!!!

I took mmalc's ToDos sample and gutted it to be simpler.  It still
worked.  Then, instead of using the NSArrayController in the NIB I
created one programatically in the MyDocument init method.  I have KVC
accessors in MyDocument:

- (NSArrayController *)catController;
- (void)setCatController:(NSArrayController *)aCatController;

Then I change the NSTableColumn binding from:

bind to: Categories (an NSArrayController in the NIB)
controller key: arrangedObjects
model key path: title

to

bind to: File's Owner (MyDocument)
controller key: n/a
model key path: catController.arrangedObjects.title

And changed other bindings analogously.  Additionally, I had to bind the
NSTableView's 'content', 'selectionIndexes', and 'sortDescriptors'
bindings as it seems IB does this behind the scenes when the controller
is in the NIB, but not otherwise.

And now I have the same problem as my app!  That is, if I change a model
object, the tableview does not update unless I resize the window or
click the tableview.  It's as if tableview has simply forgot to redraw.
Text fields update fine, but not table columns.

Shouldn't what I did work?

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden

References: 
 >Bindings: changing model changes some views but not others (NSTableColumn) (From: "Sean McBride" <email@hidden>)
 >Re: Bindings: changing model changes some views but not others (NSTableColumn) (From: Scott Stevenson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.