Using bindings to disable a control when a list is empty

Using bindings to disable a control when a list is empty

Need to disable a control such as a button when a list or table is empty? It's easy to do with bindings.

Let's assume you have an NSTableView displaying some items from an NSArrayController, and you want to disable a button when the table contains no items.
All you need to do is bind the button's "enabled" binding to your array controller's contentArray, using @count as the model key.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.