NSArrayController

  • My apologies if this has already been answered.  I am trying to
    properly bind an NSTableView to a NSArrayController.  The tableView
    has 3 columns, 2 of which use popup button cells as its data cells.
    It is these 2 columns that I am having trouble properly binding.  The
    controller has an array of objects set as its content.  I have
    entered keys to this content on the controller in its inspector.
    Each object in the content array has a list of strings that should
    display in the popup buttons.  I am not using a model, didn't really
    feel I needed to go through all that.  So in IB there are bindings
    for the column and bindings for the popup cell.  It is unclear which
    of the two I should bind, one or the other or both, and exactly which
    binding aspects and controller keys I should bind to.  Attempts to
    bind to the popup cell bindings causes errors while binding to the
    column alone looks better, but the popups are empty.  Is there anyone
    who can offer some explanation.

    Many Thanks,

    --Brian
  • I sent this yesterday but did not see it come through.....

    My apologies if this has already been answered.  I am trying to
    properly bind an NSTableView to a NSArrayController.  The tableView
    has 3 columns, 2 of which use popup button cells as its data cells.
    It is these 2 columns that I am having trouble properly binding.  The
    controller has an array of objects set as its content.  I have
    entered keys to this content on the controller in its inspector.
    Each object in the content array has a list of strings that should
    display in the popup buttons.  I am not using a model, didn't really
    feel I needed to go through all that.  So in IB there are bindings
    for the column and bindings for the popup cell.  It is unclear which
    of the two I should bind, one or the other or both, and exactly which
    binding aspects and controller keys I should bind to.  Attempts to
    bind to the popup cell bindings causes errors while binding to the
    column alone looks better, but the popups are empty.  Is there anyone
    who can offer some explanation.

    Many Thanks,

    --Brian
  • On 19 Oct 2007, at 8:19 PM, Anthony B Arthur wrote:

    > I sent this yesterday but did not see it come through.....
    >
    > My apologies if this has already been answered.  I am trying to
    > properly bind an NSTableView to a NSArrayController.  The tableView
    > has 3 columns, 2 of which use popup button cells as its data
    > cells.  It is these 2 columns that I am having trouble properly
    > binding.  The controller has an array of objects set as its
    > content.  I have entered keys to this content on the controller in
    > its inspector.  Each object in the content array has a list of
    > strings that should display in the popup buttons.  I am not using a
    > model, didn't really feel I needed to go through all that.  So in
    > IB there are bindings for the column and bindings for the popup
    > cell.  It is unclear which of the two I should bind, one or the
    > other or both, and exactly which binding aspects and controller
    > keys I should bind to.  Attempts to bind to the popup cell bindings
    > causes errors while binding to the column alone looks better, but
    > the popups are empty.  Is there anyone who can offer some explanation.
    >
    > Many Thanks,
    >
    > --Brian
    >

    You should bind the column, not the cell. You bind either
    contentValues, or the triple content + contentObjects + contentValues
    (in case the displayed values are not the same as the represented
    objects). You should bind to an array, which could be through the
    arrangedObjects of some arrayController, or directly to an array key
    of the controller object (in particular if it is a fixed array).
    Alternatively, you can bind to an array key of the objects you're
    displaying. In this case you bind to the same arrayController as the
    displayed/selected objects (but then these objects of course need to
    contain this array). This allows you to use varying sets of values in
    the different popups. But I guess you don't need this complexity.

    Christiaan
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today