On Nov 13, 2009, at 1:39 AM, Graham Cox wrote:

> 
> On 13/11/2009, at 8:18 AM, Martin Hewitson wrote:
> 
>> Has anyone tried something like this, or can anyone see what I'm doing wrong?
> 
> 
> I'm a bit mystified by your data structure here. Why do you use a separate 
> dictionary for each key/value pair (name/colour pair)? Why not just use one 
> dictionary for the list of colours, and add that as a single item to the user 
> defaults? It would be much simpler and efficient, and probably less prone to 
> difficult to understand code paths as you'd have one less level of 
> indirection (or possibly two less - you wouldn't need the array either).

The point is to store an array of 'items' with a 'name' together with a 
'color'. And later there may be more properties of an 'item'. 

Martin

> 
> I expect the problem is because the changes you're making are an extra level 
> of indirection inside the data structure and are not being observed by the 
> user defaults binding. I could be wrong though as bindings is not something 
> I'm very intimate with.
> 
> Also, check out whether NSColorList will do what you need here - it already 
> maintains lists of named colours.
> 
> --Graham
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





_______________________________________________

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 arch...@mail-archive.com

Reply via email to