Re: NSLevelIndicator Bindings Crash
Re: NSLevelIndicator Bindings Crash
- Subject: Re: NSLevelIndicator Bindings Crash
- From: Walker Argendeli <email@hidden>
- Date: Mon, 23 Mar 2009 16:04:38 -0400
Yes, you're right, Item is an NSArrayController representing the
entity "Item". Sorry about that.
ItemsList is an Entity and Array Controller representing an outline
view of folders. Each folder can have multiple Items in it.
Depending on which folder is selected in the ItemsList outline view,
the right Items will appear in the Table view whose columns are bound
to properties of the Item array controller. Depending on which item
is selected in the Item tableview, the level indicator, which is bound
to (the array controller) Item.selection.priority
For some reason though, I get the odd behavior that follows: In the
Item table view, if I have one item selected, then select a different
one, that new Item will have the levelindicator defaulted back to 1,
though it had been set to a different value previously.
I hope that's not too confusing. Thanks
- Walker Argendeli
On Mar 23, 2009, at 3:55 PM, Keary Suska wrote:
On Mar 23, 2009, at 1:13 PM, Walker Argendeli wrote:
When i do this, however, every time I switch back to another item,
the level defaults back to 1. Also, I checked that chapter in
Hillegass's book, and it had an example where it used
Car.selection.condition, so it seems that selection is the right
controller key. The bindings in general are just really funky. I
added a stepper and textbox in addition to the level indicator, and
bound them to Item.selection.priority, and they too default back to
1 (the default value) every time I go to another item. The Item
array controller's Content Set is bound to ItemsList.selection.Item
That's the only binding, other than the managed object context. I
really can't figure out what's causing this problem, which is
annoying because I'm trying to focus on fixing this before I
continue development.
Your descriptions make no sense. When referencing binding key paths,
make them relative to the controller, and not to the model. I assume
that when you say "Item.arrangedObjects.priority" you really mean
"NSARRAYCONTOLLER.arrangedObjects.priority". This is a critical
distinction, as the two paths are nowhere near the same.
Ok, so you have an entity "Item", and you have an NSArrayController
with Content Set bound to ItemsList.selection.Item. What is
ItemsList, and why does it exist? What controller is providing
content to the table view?
Generally the proper approach is: 1. array controller with bound MOC
that either performs its own fetch or is populated programmatically;
2. tableview bound (technically, columns are bound) to that array
controller; 3. detail items (level indicator and stepper) bound to
arraycontroller.selection.property (where arraycontroller is the
controller specified in #1).
That should be all there is to it.
On Mar 22, 2009, at 10:05 AM, Richard Somers wrote:
On Mar 21, 2009, at 3:41PM, Walker Argendeli wrote:
I'm using Core Data, and I have an entity; we'll call it "Item".
It has an attribute called "priority". In the xib, I have an
NSLevelIndicator and NSStepper. I have a NSTableView full of
"Items". Depending on which item is selected in the table view,
I want the level indicator and stepper to display the right
values, and for me to be able to set them to a certain value for
each item. There are 2 problems: If I bind the value of either
one to Item.arrangedObjects.priority, the app throws an
exception, whereas if I bind to Item.selection.priority, the
controls don't set each item's priority individually. What
should I bind to?
Secondly, an NSLevelIndicator wants a float for its value,
whereas an NSStepper wants a double for its value. Which should
I set it to in the core data model?
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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