If I understand correctly, every time you add an item to the NSArraycontroller, it gets selected in the NSTableview. Have you selected the preserveSelection and deselected the avoidEmptySelection of the NSArraycontroller? You also have to uncheck "selectInsertedObjects".
NSArrayController automatically selects all new items on `add:` action
-
28-06-2023 - |
Question
I have an NSArrayController
which is bound to my NSTableView
. The table view has the standard + / -
buttons.
When I press the +
button which triggers the add:
action of the NSArrayController
the new item in the list will automatically be selected, which prevents the user from editing the text in a NSTextField
inside of the cell.
In IB the selection property of the table view multiple
is not checked so multiple-selection shouldn’t even possible and is also not possible “by hand”.
I had to change the Highlight
to None
to work around the problem but now I am no longer able to delete individual columns, which is kind of fine in my case, but I am wondering how this could be solved, ideally without implementing a delegate (I prefer to just hook up stuff with the bindings for such a standard case).
Solution