Is there any way to achieve multiple selection behavior in an NSTableView without requiring the user to hold down the command button while clicking? This was easy to do in a Carbon list box, by ORing in the cmdKey modifier flag, during mouse down processing, on the call to the HandleControlClick() function. I am new to Cocoa, and it is not clear to me how I can easily modify an event programmatically, or if this is the best solution.
Subclass NSTableView and make your table view an instance of this subclass. In the subclass, respond to both mouseDown: and mouseUp: by creating a new mouse event based on the one you received, only with the NSCommandKeyMask flag ORed into the modifier flags, and passing the new event up to super.
However, I hope it will be obvious to your user that they can select multiple items. Also, don't break the Shift key—make sure contiguous selection still works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With