• 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: Editable TableView, Bindings, and an Array -- almost
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editable TableView, Bindings, and an Array -- almost


  • Subject: Re: Editable TableView, Bindings, and an Array -- almost
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 10 Nov 2005 15:54:58 -0500

It sounds like you're getting bitten by the fact that NSArrayController and NSTableView won't allow you to edit an array of strings directly. You need to have an array of some record that contains the string.. often just dictionaries.. then you can supply the keypath and the data is properly kvc compliant.

if you find this annoying, please file an enhancement request art bugreporter.apple.com


On Nov 10, 2005, at 10:45 AM, Steve@DotMac wrote:

Folks;

I'm trying to implement a simple user preference list (Ratings)

I register my defaults using: [myDefaultDictionary setObject:myArray forKey:@"RatingsList"];
This works great and I can successfully bind to a popupButton's 'contentValues-values-RatingsList' and my chosen 'selectedObject' using an NSUserDefaultsController.


So good so far.

I want to give the user control over their own rating values; add, remove, and edit the default values.

So I have implemented a 1 column editable tableView, and instantiated an arrayController in IB.

The arrayController is in object mode bound to a NSMutableArray
(editable and automatically prepares content); no connections; contentArray bindings set to NSUserDefaultsController-values- RatingsList.
The tableView has no connections and no bindings
The single tableColumn is set to editable and value is bound to arrayController's arrangedObjects w/ no keyPath.


These setting allow the tableView to correctly display the default values setup above.

So good so far.

I have an Add button connected to the arrayController's insert: and a Remove button connected to the arrayController's remove:
Note: if instead of connecting these I bind the target to either 'arrangedObjects' or 'selection' using the same selector -> runtime error.
I don't really get this - my instincts are to bind not connect but I don't understand what the target settings would be...


In any case, by connecting, the remove: works great - it will remove the selected item in the tableView and this removal is key- value compliant because the popupButton's list is immediately updated!

insert: works pretty well by adding values at the selection point but it adds '{}' as the value. This is also immediately seen by the popup
Is there a way I can control what this value would be?


But here's the REAL question.
The tableColumn is marked as editable, so the cursor can enter. This is what I would like -> in table editing of the list values.
BUT on cursor exit -> runtime error for lack of key-value compliance. Makes sense - what is the 'key' in this case? It's just an array.
Which highlights the bindings for the tableColumn - it is bound to the arrangedObjects without a keyPath...


Is there a way to achieve what I want with bindings?
So far I haven't subclassed anything and it's almost all done with bindings. This is cool.
Can I just get that last piece?


Thanks in advance,
Steve
_______________________________________________
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

_______________________________________________ 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
References: 
 >Editable TableView, Bindings, and an Array -- almost (From: "Steve@DotMac" <email@hidden>)

  • Prev by Date: CoreData, inheritance and plug-ins
  • Next by Date: Progress bar
  • Previous by thread: Editable TableView, Bindings, and an Array -- almost
  • Next by thread: howto mix objc/c++ in a nice way?
  • Index(es):
    • Date
    • Thread