• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView's "data" binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView's "data" binding


  • Subject: Re: NSTextView's "data" binding
  • From: Yann Bizeul <email@hidden>
  • Date: Sat, 28 Apr 2007 18:42:34 +0200

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 !

Thank you


Yann Bizeul • yann at tynsoe.org Cocoa Developer

Tynsoe Projects
BuddyPop • GeekTool • SSH Tunnel Manager • ...
http://projects.tynsoe.org/


Le 28 avr. 07 à 17:29, mmalc crawford a écrit :


On Apr 28, 2007, at 8:12 AM, Yann Bizeul wrote:

The problem is I want to bind "data" of this NSTextView to my NSManagedObject.
When creating my NSTextView :
[...]
[textView setRichText:YES];
[self bind:@"data" toObject:textView withKeyPath:@"data" options:nil];


You bind the text view, not the managed object.
Review <http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Concepts/WhatAreBindings.html> and <http:// developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/ Concepts/HowDoBindingsWork.html>.


Moreover, you should almost certainly be binding to an intermediary controller (an instance of a subclass of NSController) and not directly to the managed object.

mmalc



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: NSTextView's "data" binding
      • From: Shawn Erickson <email@hidden>
References: 
 >NSTextView's "data" binding (From: Yann Bizeul <email@hidden>)
 >Re: NSTextView's "data" binding (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Rotating an NSView before printing
  • Next by Date: Re: NSTextView's "data" binding
  • Previous by thread: Re: NSTextView's "data" binding
  • Next by thread: Re: NSTextView's "data" binding
  • Index(es):
    • Date
    • Thread