Question

I'm trying to achieve something similar to the Apple Master-Detail pop-up cell example but the bindings don't seem to be working for me.

My app allows users to build up a stageplay; so I have a table view of acts. Each act can have a list of lines so the acts table view drives a second table view of lines (so selecting act one updates the lines table view with the lines of that act).

This setup seems to be working fine.

Each line is of course spoken by a character, so my document object has a list of characters as well as a list of acts. What I want is a pop-up cell in my lines table with values taken from the characters array.

So I followed the steps in that Apple tutorial but it doesn't work...

  • If I bind the content of the table view column to the CharactersController.arrangedObjects and the selectedObject to LinesController.arrangedObjects.character then the binding works (when I select a value from the pop-up it updates the underlying line object with the new character), but the list shows <Character ...> entries
  • If I then bind the column's contentValues to CharactersController.arrangedObjects.name then I get the following debug error when I run the app:

    2011-03-16 11:28:49.783 ScriptPreparer[5176:903] Cocoa Bindings: 
    Error setting value <Character: 0x100144f60> of object 
    <NSPopUpButtonCell: 0x100153ff0> through binding selectedObject
    
  • If I remove the selectedObject binding then I still get the <Character...> output in the list.

It seems like the contentValues binding is the broken one. What am I doing wrong?

Here are my bindings: enter image description here

Was it helpful?

Solution

I discovered what the problem was - I had bindings set on the NSTableView as well as the Table column and the NSPopupButtonCell which was causing strange things to happen.

My conclusion is now that any table bindings not on the table column are WRONG

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top