Re: Binding popup contents difficulties [REVISITED]

  • On Wed, 31 May 2006 03:50:34 -0400, Ken Tozier <kentozier...> said:
    > Although I can get popup bindings working if all I use is an array of
    > strings, what I'd really like to do is store an array of dictionaries
    > in my model and have the menu display a specific field from each
    > dictionary.
    >
    > Here's the dictionary array structure in my model:
    > sites (
    > {id=1, name='Boston', state='Masachusetts'},
    > {id=2, name='New York',  state='New York'},
    > {id=1, name='Chicago', state='Illinois},
    > {id=1, name='Los Angeles', state='California'},
    > etc...
    > )
    >
    > Here are the popup bindings I'm attempting in the IB inspector palette:
    > Value Selection:
    > contentValues:
    > Bind to: PopupArrayController
    > Controller Key: arrangedObjects
    > Model Key path: name

    Step 1: Start with an NSPopUpButton and an NSArrayController.

    Step 2: Bind the NSPopUpButton to the NSArrayController in three ways: its
    content (to arrangedObjects), its contentValues (to arrangedObjects.name),
    and its selectedIndex (to selectionIndex).

    Step 3: There is no step 3. m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
  • > Step 1: Start with an NSPopUpButton and an NSArrayController.
    >
    > Step 2: Bind the NSPopUpButton to the NSArrayController in three
    > ways: its
    > content (to arrangedObjects), its contentValues (to
    > arrangedObjects.name),
    > and its selectedIndex (to selectionIndex).
    >
    > Step 3: There is no step 3. m.

    3. Profit!

    Thanks Matt works great now

    Ken