Reputation: 21
I have an NSTableView hooked up to Core Data. Here is what I want to do.
The table has two columns. When I finish editing the first column, and press tab to go to the next column, I want to programmatically populate the second column based on the first column's data. Is there a delegate method that can help me with this?
Thanks
Upvotes: 0
Views: 439
Reputation: 20136
Yep its not too hard once you understand how the apple frameworks work.
You simply need to have your controller object (that sits behind the table) become a "delegate" to listen for events events in the text field in the first text box.
When your controller receives a message that a user has left the first text box, that data from the first text box can be read and passed onto the model object (which stores all your data).
Your model object would know how to update what should be in the second field and send a message back to your controller that the second column has changed and needs updating
(IF this is confusing you need to read up apples documents on MVC (Model View Controller).)
Upvotes: 0
Reputation: 96333
That's not how a table view works. Every row is one item, and the columns are different properties of that item. Attempting to do otherwise is fighting the framework and the HIG.
Perhaps you want an NSBrowser instead.
Upvotes: 1