Editable TableView, Bindings, and an Array -- almost
Editable TableView, Bindings, and an Array -- almost
- Subject: Editable TableView, Bindings, and an Array -- almost
- From: "Steve@DotMac" <email@hidden>
- Date: Thu, 10 Nov 2005 09:45:29 -0600
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