Hi Dirk, If you want to use an NSTreeController to show your data in an NSOutlineView, your plist will probably look something like the following:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array> <dict> <key>name</key> <string>Day1</string> <key>children</key> <array> <dict> <key>name</key> <string>morning</string> <key>children</key> <array> <string>purchase1</string> <string>purchase2</string> <string>purchase3</string> </array> </dict> <dict> <key>name</key> <string>afternoon</string> <key>children</key> <array> <string>purchase4</string> <string>purchase5</string> </array> </dict> </array> </dict> <dict> <key>name</key> <string>Day2</string> <key>children</key> <array> <dict> <key>name</key> <string>morning</string> <key>children</key> <array> <string>purchase6</string> <string>purchase7</string> </array> </dict> </array> </dict> </array> </plist> (You may need the leaves to be something other than strings, but you can see what the basic structure looks like.) Then you set up your NSTreeController with "children" as its key path for children, and bind your NSOutlineView's table column to your tree controller's arrangedObjects.name. Bind your outline view's content to the tree controller's arrangedObjects, and bind the tree controller to the array you got from the plist, and you should see your data. Best wishes, Hamish On Wed, Mar 26, 2008 at 7:50 PM, D. Hoffmann <[EMAIL PROTECTED]> wrote: > Dear Hamish, > > Thanks for your deep answer. > What I've right at the moment is your last given alernative : { key1 > > => [object2, object3], key4 => [object5, object6] } > In other words I save something like : Day1{key} => morning, noon, > evening{3 objects in NSArray} > > What I want to save to plist is : Day1{key or 1st level}=> morning > {1st object of second level} => purchase1 {1st object of third level} > > > =>purchase2 {2nd object of > third level} > > > =>purchase3 {3rd object of > third level} > > > => noon {2nd object of second > level => purchase4 > > > =>purchase5...... > > I hope, this makes it more understandable. It has to be underlined > that purchase 1 to 3 "belong" to morning, purchase 4 and 5 belong > to noon in a sense that if I reload the plist into my application > and show them via NSOutlineview, still purchase 1 to 3 is shown below > morning, purchase 4 and 5 are shown below noon (of course everything > mentioned belongs to Day1. Day2 or Day3 would look similar). > > Do you have an idea how to manage this. Maybe you already told me > with the beforementioned but I don't see it at the moment :-))) > > Thanks and regards > Dirk > > > > > > > Am 26.03.2008 um 19:11 schrieb Hamish Allan: > > > > > On Wed, Mar 26, 2008 at 4:07 PM, <[EMAIL PROTECTED]> wrote: > > > >> Now i tried to go one step further for what I need to accomplish, > >> instead of saving 2 levels (the key and the corresponding object) I > >> want to save 3 levels (Key, object and another object linked to the > >> first object). > > > > It's not quite clear what you mean by "linked to". Do you mean you > > want to use two keys to arrive at each object? If so, the objects of > > your first dictionary should themselves be dictionaries: > > > > { key => { key => object, key => object } , key => { key => object, > > key => object } } > > > > Or the keys could be arrays: > > > > { [key, key] => object, [key, key] => object } > > > > Or perhaps you mean you want each key to yield two objects? In which > > case, the objects of your dictionary should be arrays: > > > > { key1 => [object2, object3], key4 => [object5, object6] } > > > > Hamish > > _______________________________________________ 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]