NSButtonCell in NSTableView: click handling

倖福魔咒の 提交于 2019-12-07 09:08:38

问题


I set NSButtonCell as a cell type in a Table Column in my NSTableView. I implemented an IBAction method, but I can't wire it with NSButtonCell in IB - the wire don't want to highlight a button from NSTableView.

How to connect a method with NSButtonCell? Or maybe there'se another way to handle its click event?

Thanks


回答1:


You should be able to wire up a connection from the cell by control+dragging to any object in your NIB. Just make sure the cell is actually selected, and that your action is defined as an IBAction in the object's header file. In your action method you can determine which row was selected by calling [tableView clickedRow].

Edit: Here's a demonstration. Make sure you click at least four times on the check box to get it selected, hold down the control key and drag from the cell to your object.



来源:https://stackoverflow.com/questions/8522965/nsbuttoncell-in-nstableview-click-handling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!