简体   繁体   中英

Controlling editing in NSTableView

I have subclassed NSTableView and NSTableColumn, and I want to control processus of edition of the cells of the table.

I have 2 states for my table class: edition and nonedition. whatever the state of the table, when the user select a row, the row has to be overlighted.

if the table is in state edition, the controls corresponding to the selected row must be visible.

I use the function rowview to make this possible, but I have no success. 1 when I click on the text cell of a cell, the control appears always. 2 when the rowview function is called, I don't understand the value of the row parameter. Sometimes it is correct, sometimes it is incorrect.

is it someone who could hep me?

I want to make precision: to simplyfy, in my subclassed NSTableView, I write this code: override func rowView(atRow row: Int, makeIfNecessary: Bool) -> NSTableRowView? { let aRow = super.rowView (atRow: row, makeIfNecessary: makeIfNecessary) if aRow != nil { Swift.print("rowview is called for row (row)") } return aRow } override func rowView(atRow row: Int, makeIfNecessary: Bool) -> NSTableRowView? { let aRow = super.rowView (atRow: row, makeIfNecessary: makeIfNecessary) if aRow != nil { Swift.print("rowview is called for row (row)") } return aRow }

When I click on row 0, I have the following result: " rowview is called for row 1 " Then when I click on row 1: " rowview is called for row 1 rowview is called for row 0 rowview is called for row 2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM