Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ace2600

macrumors member
Original poster
Mar 16, 2008
71
0
Austin, Texas
I have a basic Core Data application for an array of Jobs displayed in an NSTableView. I want to add a WebView that will load the string inside the job.htmlSummary attribute for the selected item in the table view (job is my entity). If I use an NSTextField, I can simply use "Bind To: Jobs" for Value in the bindings inspector with Model key path set to htmlSummary.

However, I have no idea how to do this for the WebView. I know the code would be something like
Code:
[[webView mainFrame] loadHTMLString:selectedItem.htmlSummary baseURL:myUrl];
But I do not know how to call this every time the selection changes. Or how that binding works.

P.S. I am using Hillegass's chapter on creating a Core Data document application as the inspiration. CarLot is the example.
 

ace2600

macrumors member
Original poster
Mar 16, 2008
71
0
Austin, Texas
After thinking about the problem more, I'm really just after a way to be notified when the selection changes. I can load the HTML into the WebView and everything programmatically after that.

How can I run an action on every selection change in the NSTableView?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.