I had been looking for a way to automatically select-all when a user clicks in an NSTextField. By default, the convention in OS X is to put the insertion point where the user clicks (assuming the textfield is editable). After much googling and trial and error I eventually subclassed NSTextField, then overrode mouseDown. I actually put nothing in the method, and yet achieved the desired results. I simply reassigned my NSTextFields in my XIB to be of my subclassed type and suddenly it worked as I desired.
Categories