Re: Bind to element in dictionary in array
Re: Bind to element in dictionary in array
- Subject: Re: Bind to element in dictionary in array
- From: Trygve Inda <email@hidden>
- Date: Wed, 28 Jun 2006 20:47:14 +0000
- Thread-topic: Bind to element in dictionary in array
> First off, sorry I misread your model, what I meant was [Dict
> valueforKeyPath:@"MyArray.someBoolValueD"] would return an array
> (containing each element's value for someBoolValueD).
> Secondly, I misunderstood what you were asking:
>> dict.MyArray[index].someBoolValueD <- this does not seem to work
>
> As far as I know, there is no way to specify [index] so that you get
> a particular entry in the array.
>
> The only ways I can think to work around that is:
> - keep a local variable set to that array element (which you said you
> didn't want to do)
> - use a dict instead of an array so you can refer to each entry by
> name (even if the names are "element1", "element2", etc)
>
> A dict seems to make more sense than an array anyway. Since you would
> have to know how many members are going to be in the array in order
> to bind to a particular element... I'm guessing adding to dict
> instead with a particular key name shouldn't be a problem.
> If you were to do that setup (for say, a table view) the Object Class
> Name would just be NSMutableDictionary, since that is what each
> element of the array is.
Let me explain a bit more. I need a mutable array of mutable dicts. This
array will be embedded in a larger mutable dict whch will be saved as the
user's prefs.
My mutable array will hold a mutable dict for each screen attached and look
like:
-Array
--- Dict
- someValueA
- someValueB
- someValueC
--- Dict
- someValueA
- someValueB
- someValueC
- (End Array)
My Pane works like the monitors pref pane so a separate window is spawned
for each display. In my master window I want to bind controls to the first
dictionary in the array and if there are more displays I want to spawn
windows and then programatically bind their controls to dict #2, 3 etc.
Is this possible?
Trygve
_______________________________________________
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