• 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
NSObjectController: can't populate all elements of NSMutableDictionary in File's Owner (part deux)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSObjectController: can't populate all elements of NSMutableDictionary in File's Owner (part deux)


  • Subject: NSObjectController: can't populate all elements of NSMutableDictionary in File's Owner (part deux)
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Tue, 27 Dec 2005 09:07:14 -0800

Hello and thanks for you help!

The target: newGeoEntity (NSMutableDictionary) in File's Owner (NSPersistentDocument)

Screen Fields ---> NSObjectController ---> newGeoEntity (NSMutableDictionary) in File's Owner.


1) The NSObjectController target keys are:
newName, <-- NSTextField
newMap, <-- NSImageView
newMemo, <-- NSTextView
newRegion <-- NSMatrix (Radio Button)

2) I made a typo in my last message. The NSObjectController's contentObject is actually:
contentObject: = newGeoEntry[File's Owner(NSPersistentDoc)].

3) Each of the front-end fields are bind (bound) to their respective NSObjectController keys.

My problem:

This is what the debugger shows after I filled out each field and looked 'under the covers':

(gdb) po [self newGeoEntity]
<NSCFDictionary 0x375650>{
Default Entity = name;
newRegion = 3; <---- NSMatrix binds okay.
newName = This is the Name Field; <--- NSTextField binds okay.
}

-----------------------

I looks like the NSObjectController is *partially* working.
a) The 'newName' (NSTextField) & newRegion (NSMatrix) are binding correctly.
b) But the newMemo field (NSTextView) and newMap (NSImageView) ARE NOT BOUND.
c) When I set the NSTextView's attribute to work only with NSString (not allowing change of fonts), the compiler bombs.

newMemo Value binding:
data = selection.newMemo [NewGeoData (NSObjectController)]

newMap Value binding:
data = NSUnarchiveFromData(selection.newMap) [NewGeoData (NSObjectController)]

Questions:
1) Why do I get the following compiling error if I set NSTextView's 'Allow User to Change Fonts' attribute to FALSE (deselect it)?

2005-12-27 08:57:28.358 Global Village[3532] [<NSTextView 0x3ba9b0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key data.

1a) How would I correct this?

2) Why don't I see data for the NSImageView within newGeoEntity (NSMutableDictionary) -- am I using the wrong
Value Transformer (NSUnarchiveFromData)? -- It appears I need the 'archve to data'--> into a NSData object.

3) What's with the 'Default Entity - name'; found in newGeoEntity (NSMutableDictionary)?


Thanks for the help,

Regards,

Ric.

===================================================

FROM : mmalcolm crawford
DATE : Tue Dec 27 10:03:06 2005

On Dec 26, 2005, at 9:19 PM, Frederick C. Lee wrote:

If I understand correctly what you're trying to achieve (that is,
have the "Add" button addd values for the relevant keys in the
dictionary):

> 1) The 'Add' button doesn't appear to do anything.


Add will only add an instance of whatever it is that the object
controller manages. If you want to add attributes of that object,
you must do so independently.

> Chosen Properties of NSObjectContoller:
> Attributes:
> Object Class Name: NSMutableDictionary {keys: newName,
> newImage, newMemo, newRegion}
> Bindings: Controller Content:
> contentObject: {file's owner (NSPersistentDocument}
>

Assuming that this is correct (i.e. no typos and that you have bound
the 'content' of the object controller just to File's Owner, and not
specified a keypath) then this is inconsistent -- the class is not a
mutable dictionary -- although it probably matters little here. You
need to specify the keypath from file's owner to your dictionary --
from the later description, presumably newGeoEntity.

So the object controller's content should probably be bound to
[File's Owner].newGeoEntity

mmalc



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: NSObjectController: can't populate all elements of NSMutableDictionary in File's Owner (part deux)
      • From: mmalcolm crawford <email@hidden>
    • Re: NSObjectController: can't populate all elements of NSMutableDictionary in File's Owner (part deux)
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: The other format strings?
  • Next by Date: Re: Prevent running in Rosetta
  • Previous by thread: The other format strings?
  • Next by thread: Re: NSObjectController: can't populate all elements of NSMutableDictionary in File's Owner (part deux)
  • Index(es):
    • Date
    • Thread