Filling in a matrix of NSTextFields

OK, next question :lol:

I have created a NSMatrix of NSTextField cells. The matrix is 8 rows by 4 columns. The NSTextField cell at row 1, column 1 is selectable and editable. The remaining NSTextField cells in column 1 are NOT selectable and editable. All of the NSTextField cells in column 1 have a date formatter attached to them using the short date format. I can get a NSDate object from the cell at row 1, column 1. In a loop I’d like to add 1 day to the date each time through the loop and put that date in the cell in the next row. I can add the day to the date but I can’t figure out how to easily add that to each of the cells.

I have found: setState_atRow_column_(date object, x, 0) – that doesn’t work for adding the date object

I can: selectTextAtRow_column_(x, 0)

but I can’t: setText_atRow_column_(text, x, 0)


You use the cellAtRow_column_ method to get you to a particular cell in the matrix, and then you send the message to it just like it were a named text field – so if you had a text field named myField you would get a date into it with: myField’s setObjectValue_(theDate). So with a matrix named “mat” and a date called theDate, you would do this:

mat's cellAtRow_column_(1, 0)'s setObjectValue_(theDate)


Thanks Ric. I’m looking forward to the day when I can ANSWER others questions instead of needing to ASK the questions myself!! :smiley: