Re: NSLevelIndicator Bindings Crash
Re: NSLevelIndicator Bindings Crash
- Subject: Re: NSLevelIndicator Bindings Crash
- From: Keary Suska <email@hidden>
- Date: Mon, 23 Mar 2009 13:55:02 -0600
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