• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binding to an NSArrayController however binding is 1-way only.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding to an NSArrayController however binding is 1-way only.


  • Subject: Re: Binding to an NSArrayController however binding is 1-way only.
  • From: dreamcat7 <email@hidden>
  • Date: Thu, 18 Sep 2008 15:50:24 +0100


On 18 Sep 2008, at 11:44, Ken Thomases wrote:

1) If you for some reason find that using bindings with NSTableView is too restrictive, you might want to think about falling back to the pre-bindings way of populating a table view: the data source.
Yes, noted.

2)... If you implement the to-many indexed accessors, you can make a to-many property that works however you like under the hood.... in the comments at the declaration of -mutableArrayValueForKey: in NSKeyValueCoding.h. (Sadly, the documentation for that method doesn't seem to be correct/complete.)

Thank you Ken for pointing this out. I have now found this in thread the Archives. Was discussed here:


 http://www.cocoabuilder.com/archive/message/cocoa/2008/6/28/211487

3) You seem to be building a model which is based on an NSArrayController. (I.e. you tried to make your dates and emails properties by binding through the controller's arrangedObjects property.) This gets things backwards. Your model should not have any dependencies on your controller(s).

In a typical hierarchy and with those terminology which you were using:

Model (item) -> Model (array) -> Mediating controller (and possibly other mediating controller) --> Co-ordinting controller -> application.

I dont dispute the above is the correct way to build a Cocoa application.

It's possible that I misunderstood. Perhaps dates and emails are properties of your coordinating controller which you intend to be a synthesis of values from your model. That's OK. However, if you do that, then you still shouldn't base it on an NSArrayController. It should be based directly on your model plus some controller-level logic. Then, an NSArrayController could be built which presents that synthetic property to your view layer.

Well yes the presence of the arraycontroller is there for the tableview and to provide sorting on the array data.
Its simply very convenient because of the good selection and sorting features provided by NSArrayContoller.


if either i did not need sorting, or was using the DataSource method you suggested in 1), then there would be fewer reason to use it.
My needs are indeed rather specific and in this instance. I shall email you the source code code off-list.


In my opinion, a coordinating controller should not depend upon a mediating controller. It should be the other way around.
Yes, i agree.


Cheers,
Ken


_______________________________________________

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


References: 
 >Binding to an NSArrayController however binding is 1-way only. (From: dreamcat7 <email@hidden>)
 >Re: Binding to an NSArrayController however binding is 1-way only. (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Modal dialog without NSApplication
  • Next by Date: Re: How to call functions of a C dylib on a C++ dylib
  • Previous by thread: Re: Binding to an NSArrayController however binding is 1-way only.
  • Next by thread: CoreData _PK NSManagedObject
  • Index(es):
    • Date
    • Thread