Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling NSButton with bindings, based on NSTableView selection

I have a NSWindow containing an NSButton and an NSTableView.

I'd like the button to be enabled if and only if the table contains at least one item, and exactly one item is selected. (The table does not allow multiple selection.)

What can I bind the button's enabled binding to to make this happen?

like image 380
Paul Schreiber Avatar asked Dec 09 '09 08:12

Paul Schreiber


1 Answers

This is an old thread, but here are my 2 cents: Use and array controller and bind the button's enabled state to

Controller Key: selectedObjects Model Key Path: @count

Works fine.

like image 75
Lazloman Avatar answered Sep 19 '22 13:09

Lazloman