Skip navigation.
 
mlRe: Bind to element in dictionary in array
FROM : Trygve Inda
DATE : Wed Jun 28 22:47:14 2006

> 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

Related mailsAuthorDate
mlBind to element in dictionary in array Trygve Inda Jun 28, 18:43
mlRe: Bind to element in dictionary in array George Orthwein Jun 28, 19:04
mlRe: Bind to element in dictionary in array Trygve Inda Jun 28, 19:48
mlRe: Bind to element in dictionary in array George Orthwein Jun 28, 21:05
mlRe: Bind to element in dictionary in array Trygve Inda Jun 28, 22:47
mlRe: Bind to element in dictionary in array Matt Neuburg Jun 29, 16:09
mlRe: Bind to element in dictionary in array Trygve Inda Jun 29, 16:21
mlRe: Bind to element in dictionary in array Matt Neuburg Jun 29, 18:24