0

When I select a row in my outline view (connected to a NSTreeController) and click the remove button it doesn't delete the row that I have selected but actually deletes the row at the bottom of the table. For some more information here is my Connections for the Button:

http://snapplr.com/t1hm

and the Entity model:

http://snapplr.com/k6n3

If you need more info feel free to comment.

Joshua
  • 15,200
  • 21
  • 100
  • 172
  • 2
    Are you sure you've connected the button to the right controller? Your screenshot shows that it's sending the remove: message to an Array Controller, not a Tree Controller. – Alex Jun 05 '09 at 18:30
  • Just connected it to NSTreeController and It won't let me delete. Just Corrected The Links Aswell. – Joshua Jun 05 '09 at 18:47
  • 1
    Joshua: Commenting on your own question saying “Any answers please” does exactly nothing to promote answers. Anybody who's reading your question is either going to answer it anyway or *not* going to answer it anyway. – Peter Hosey Jun 05 '09 at 23:37

1 Answers1

2

First, echoing Alex's comment, correct both bindings to be bound to the tree controller instead of the array controller.

Second, make sure you bind the outline view's “Selection Index Paths” binding to the tree controller's selectionIndexPaths property, so that the tree controller knows what's selected.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
  • Thanks, I have corrected both bindings and have bidden the outline view's “Selection Index Paths” binding to the tree controller's selectionIndexPaths property but now it will not let me add any rows to the outline view. Here is a picture of the Outline View Binding. – Joshua Jun 06 '09 at 06:44
  • Have you a solution for my current problem? – Joshua Jun 06 '09 at 13:21
  • What exactly do you expect posting multiple comments on my answer to do? – Peter Hosey Jun 06 '09 at 16:40
  • Hopefully spark a Response or Answer to my earlier comment. – Joshua Jun 06 '09 at 17:39
  • Do you know why it will not longer let me add or delete any rows? – Joshua Jun 06 '09 at 17:40
  • “Hopefully spark a Response or Answer to my earlier comment.” Posting *one* comment might do that, but multiple comments does not. “Do you know why it will not longer let me add or delete any rows?” No. – Peter Hosey Jun 06 '09 at 18:26
  • 1
    I suggest putting some breakpoints in your code and stepping through it while trying to add or delete rows. – Abizern Jun 07 '09 at 03:58
  • Joshua, since you're unaware of what a breakpoint is; here's a link to Xcode's debugging guide which explains what they are and how to use them, as well as other ways to find out why your program isn't working as you expect. http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeDebugging/000-Introduction/Introduction.html – Abizern Jun 07 '09 at 12:50
  • Ah, I understand how to use breakpoints now, but where should I put them because I don't know what is going wrong. I know it only happens when I add the selectionIndexPaths binding, but there is no error in the de-bugger or anything. So i can't seem to find out whats is going wrong. – Joshua Jun 07 '09 at 13:16