문제

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).

highlight

도움이 되었습니까?

해결책

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".

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top