Re: Creating bindable properties editors for Core Data entities
Re: Creating bindable properties editors for Core Data entities
- Subject: Re: Creating bindable properties editors for Core Data entities
- From: Karolis Ramanauskas <email@hidden>
- Date: Thu, 26 Feb 2009 16:39:20 -0600
Hello, thnaks for your help, Jon,
So I have a lot of this working now, but I have a problem!
I created a XIB with one window, several views. When a user clicks on the
object in the main view this happens:
- (void)showPropertiesWindowFor:(KRSimFlowElement *)flowElement {
FlowElementsPropertiesWindowController * propertiesController =
[[FlowElementsPropertiesWindowController alloc]
initWithWindowNibName:@"FlowElementsPropertiesWindows"
owner:flowElement];
[propertiesController showWindow:flowElement];
}
(I know the memory management here is a bit iffy ;))
then the controller does this:
- (void)awakeFromNib {
if ([[[self window] delegate] isMemberOfClass:[KRSimAssimilator class]])
{
[[self window] setContentView:assimilatorPropertiesView];
}
if ([[[self window] delegate] isMemberOfClass:[KRSimReserve class]]) {
[[self window] setContentView:reservePropertiesView];
}
}
The problem is that these properties are for core data entities. I set up
bindings for each view separately, but each entity has different attributes.
When I try to load properties for one entity other views complain that that
entity is not key value coding-complient:
[<KRSimReserve 0x1ba0d0> valueForUndefinedKey:]: the entity KRSimReserve is
not key value coding-compliant for the key areaSpecificIngestionRate.
Is there a way to salvage my structure or will I have to separate each
property view to it's own XIB?
Thanks a lot,
Karolis
On Thu, Feb 26, 2009 at 8:09 AM, Jon C. Munson II <email@hidden> wrote:
> Namaste!
>
> This reply is off-list.
>
> Here is my input, for what it's worth:
>
> >
> > 1. Create a template window in IB;
> > 2. Create several template views in IB containing specific properties for
> > each entity.
> >
> > Now I'm lost:
> >
> > 1. How should I proceed? Create separate NIB for this window and views?
> [Jon C. Munson II] You could without issue. It may be easier to manage
> your project and create re-usability
>
> > 2. How do I pass a reference of the selected object to a specific window
> > from showPropertiesWindowFor:?
> [Jon C. Munson II] Create an ivar that you would set once you create an
> instance of your window/nib from step 1.
>
> > 3. How do I make the properties bind to that object I just passed?
> [Jon C. Munson II] By passing a reference to the current object, and if
> your object is a Core Data entity (from your title I assume it it), you can
> set the array controller for that object. From there you can bind your
> properties to the that of the array controller. Alternatively, you could
> simply bind to your object's properties. The idea is the same, only the key
> path changes.
>
> > 4. I want to be able to open as many properties windows as I want for
> each
> > instance of an object, but if I double click on the object that has a
> > window
> > already open it should only come into focus...
> [Jon C. Munson II] see -makeKeyAndOrderFront. Use that after you've
> checked for an instance of that window which you may want to also tie to the
> respective object.
>
_______________________________________________
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