Fixing -[NSTableView setEnabled:] for view-based tables

Ilya Kulakov
Nov 19, 2020

--

View-based NSTableView that was introduced with Mac OS X 10.7 brought a long sought relieve to platform developers. Yet ever since its behavior was somewhat surprising and documented. One such quirk is the isEnabled status of a view-based table view.

Being a subclass of NSControl the table inherits the isEnabled/setEnabled: family of methods. In the old era of NSCell status’s change would be forwarded to every cell of every column: that’s because NSCell provides a monstrous interface which also includes these methods.

Contrary, NSView does not support it and thus setEnabled: has no effect on view-based tables. To circumvent it every subview whose state needs to be adjusted must be configured explicitly (either directly or via Cocoa bindings).

And here is another quirk: bindings of views inside the table must target their enclosing cell view and nothing else. Any other target such as NSUserDefaultsController or a subclass of NSObjectController will cause the binding to be silently dropped and reset to nil.

I have filed a bug report and documentation improvement feedback, but doubt highly they ever will get addressed. It’s been almost 10 years after all.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ilya Kulakov
Ilya Kulakov

Written by Ilya Kulakov

Tech Entrepreneur and Quality Freak with passion.

No responses yet

Write a response