0
votes

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?

1
Why did you subclass NSTableView and NSTableColumn and which methods did you override? Which NSTableViewDelegate methods are implemented? Where are the controls, inside each row or outside the table view?Willeke
this is a very long story. In fact, I subclass all the apple control components, because I want them to interacts each other in my manner. I'm tired of writte and re-writte code, so I have written those subclassed components. And it works perfectly well, except that I put them recently in a pod. And by making this pod, the reactions of the tableview is not the same. For instance, I overrided the function rowView(atRow row: Int, makeIfNecessary: Bool) and when I select the first row this function is called by the system with the value of row equal to 1, not 0.Patrice Rapaport

1 Answers

0
votes

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 }

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"