FROM : Shawn Erickson
DATE : Sat Apr 28 19:06:38 2007
On Apr 28, 2007, at 9:42 AM, Yann Bizeul wrote:
> Well, that's my problem, I never know what i should bind to what.
>
> For this specific question, I have a core data application, and a
> NSArrayController object in my nib, handling collection of "Block"s.
> When I add a block, I create a new BlockView, a new Block
> managedobject, and bind properties of Block to my NSView, if I do
> not do that way (i.e. if I bind my NSView's property to my Block's
> property) it does not work, so I do :
>
> [aBlock bind:@"rect" toObject:blockView
> withKeyPath:@"frameAsString" options:nil]; // Works fine
> [aBlock bind:@"data" toObject:blockView withKeyPath:@"data"
> options:nil]; // problem here
>
> but my "data" binding is special because i'm trying to "bounce" the
> binding to a NSTextView inside this NSView, like this, in my
> BlockView code :
>
> [textView bind:@"data" toObject:self withKeyPath:@"data" options:nil];
>
> I thought the bound object is the View object, that's why I bind (I
> send the bind message to) my NSView, to bind a NSManagedObject
> property, and then, to my NSTextView, to bind my NSView property.
>
> You're right when you say I do not use any controller but the
> NSArrayController. should I ?
>
> As you see, I'm quite confused, I'll take a closer look at the doc
> you pointed me to, I already red them but obviously not fully
> understood them !
You are essentially using bindings in an direction opposite to what
you would normally do. Additionally model objects should never need
to know about view objects, it isn't their responsibility.
Normally you do something like the following when using bindings ...
data objects <--- content ---< controller objects <--- bind ---< view
objects
I encourage you to stop what you are working on and explore some of
the tutorials on Core Data and bindings.
I suggest the following in addition to what Mmalc will/has outlined...
<http://www.cocoadevcentral.com/articles/000080.php>
<http://www.cocoadevcentral.com/articles/000085.php>
<http://www.cocoadevcentral.com/articles/000086.php>
-Shawn
DATE : Sat Apr 28 19:06:38 2007
On Apr 28, 2007, at 9:42 AM, Yann Bizeul wrote:
> Well, that's my problem, I never know what i should bind to what.
>
> For this specific question, I have a core data application, and a
> NSArrayController object in my nib, handling collection of "Block"s.
> When I add a block, I create a new BlockView, a new Block
> managedobject, and bind properties of Block to my NSView, if I do
> not do that way (i.e. if I bind my NSView's property to my Block's
> property) it does not work, so I do :
>
> [aBlock bind:@"rect" toObject:blockView
> withKeyPath:@"frameAsString" options:nil]; // Works fine
> [aBlock bind:@"data" toObject:blockView withKeyPath:@"data"
> options:nil]; // problem here
>
> but my "data" binding is special because i'm trying to "bounce" the
> binding to a NSTextView inside this NSView, like this, in my
> BlockView code :
>
> [textView bind:@"data" toObject:self withKeyPath:@"data" options:nil];
>
> I thought the bound object is the View object, that's why I bind (I
> send the bind message to) my NSView, to bind a NSManagedObject
> property, and then, to my NSTextView, to bind my NSView property.
>
> You're right when you say I do not use any controller but the
> NSArrayController. should I ?
>
> As you see, I'm quite confused, I'll take a closer look at the doc
> you pointed me to, I already red them but obviously not fully
> understood them !
You are essentially using bindings in an direction opposite to what
you would normally do. Additionally model objects should never need
to know about view objects, it isn't their responsibility.
Normally you do something like the following when using bindings ...
data objects <--- content ---< controller objects <--- bind ---< view
objects
I encourage you to stop what you are working on and explore some of
the tutorials on Core Data and bindings.
I suggest the following in addition to what Mmalc will/has outlined...
<http://www.cocoadevcentral.com/articles/000080.php>
<http://www.cocoadevcentral.com/articles/000085.php>
<http://www.cocoadevcentral.com/articles/000086.php>
-Shawn
| Related mails | Author | Date |
|---|---|---|
| Yann Bizeul | Apr 28, 17:12 | |
| mmalc crawford | Apr 28, 17:29 | |
| mmalc crawford | Apr 28, 17:48 | |
| Yann Bizeul | Apr 28, 18:42 | |
| Shawn Erickson | Apr 28, 19:06 | |
| Yann Bizeul | Apr 30, 00:04 | |
| mmalc crawford | Apr 30, 00:28 | |
| Yann Bizeul | Apr 30, 00:50 |






Cocoa mail archive

