I'm trying to set up a Master-Detail binding with User Defaults under OS X 10.4.11. It is correctly reading values I manually put into the Preferences file. I can select different items in the table and the detail items display the correct information, but no changes are written to the file. If I add an item to the array (using a button connected to the NSArrayController's insert: action), an item is added to the table. I can edit the name of the item in the table and change its details and see those changes if I select another table item the select the new one again, but when I quit my program and look at the preferences file, an empty dictionary has been added to the array.

I also have "normal" preference items in the same window that work fine.

Is there something I'm doing wrong or is this just not a supported usage?

Here's the setup in Interface Builder:

NSArrayController:
        Name: Variables
        Object class Name: NSMutableDictionary
        contentArray bindings:
                Bind to: Shared User Defaults
                Controller Key: values
                Model Key Path: variables

NSTableColumn value bindings:
        Bind to: Variables (NSArrayController)
        Controller Key: arrangedObjects
        Model Key Path: name

NSPopUpButton selectedIndex bindings:
        Bind to: Variables (NSArrayController)
        Controller key: selection
        Model Key Path: lineWidth

NSPopUpButton selectedIndex bindings:
        Bind to: Variables (NSArrayController)
        Controller key: selection
        Model Key Path: lineSymbol

Relevant contents of Preferences file (the second array element is an empty dictionary that was inserted with the NSArrayController's insert: action):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>variables</key>
        <array>
                <dict>
                        <key>lineSymbol</key>
                        <integer>8</integer>
                        <key>lineWidth</key>
                        <integer>2</integer>
                        <key>name</key>
                        <string>R</string>
                </dict>
                <dict/>
                <dict>
                        <key>lineSymbol</key>
                        <integer>1</integer>
                        <key>lineWidth</key>
                        <integer>1</integer>
                        <key>name</key>
                        <string>PRES</string>
                </dict>
                <dict>
                        <key>lineSymbol</key>
                        <integer>12</integer>
                        <key>lineWidth</key>
                        <integer>3</integer>
                        <key>name</key>
                        <string>RHO</string>
                </dict>
        </array>
</dict>
</plist>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to