Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTableView and backspace event (delete row) - fieldeditor/firstresponder?

Is it possible to make my NSTableView accept a deleteevnt (backspace og even cmd+backspace) ? I have an NSMenu where i have my delete-menu-item connected to my first responder object in the nib.

Any pointers?

like image 857
Rasmus Styrk Avatar asked Feb 09 '11 14:02

Rasmus Styrk


1 Answers

One approach which is easy to implement:

  1. add +/- buttons to your interface in IB and connect them to a deleteRecord IBAction
  2. with the delete (-) button selected in IB, navigate to Attributes Inspector > Button > Key Equivalent
  3. click in the box to start recording your keypress, then hit the Delete/Backspace key

When you build your project, given that you implement the deleteRecord method, a Backspace keypress will delete records from your tableview

like image 93
Demian Turner Avatar answered Nov 03 '22 03:11

Demian Turner