Hey guys, it's me again.
I'm branching out away from Aaron Hillegass' book to write a piece of my own software and put to use some of the stuff I've learned.
What I've got is pretty simple so far. It's basically just an app to keep track of all of your college classes. There's an NSTableView, with an NSButton titled "Add Class...". The button brings down a sheet, which has an NSTextField where the person types in the name of the class, and another NSButton ("Add") to close the sheet and add the class to the list of classes.
How I have it now, is the Add button on the sheet simply adds an instance of my CollegeClass to the table, but I can only get it to display with a static name, which then must be edited by the user later. It's difficult to explain, but this is happening because I have a Controller class which handles the NSTextField outlet, but a CollegeClass class which creates the objects. How can I tell the CollegeClass class to do... [self setClassName:[NSTextField stringValue]] if the NSTextField is an outlet designated in the Controller class? I tried importing the Controller header into the CollegeClass file, but it still doesn't recognize it.
Also, the Add button on the panel is linked to an NSArrayController that inserts the object. How can I have it do this and ALSO close the sheet?
Here's a pic!
I'm branching out away from Aaron Hillegass' book to write a piece of my own software and put to use some of the stuff I've learned.
What I've got is pretty simple so far. It's basically just an app to keep track of all of your college classes. There's an NSTableView, with an NSButton titled "Add Class...". The button brings down a sheet, which has an NSTextField where the person types in the name of the class, and another NSButton ("Add") to close the sheet and add the class to the list of classes.
How I have it now, is the Add button on the sheet simply adds an instance of my CollegeClass to the table, but I can only get it to display with a static name, which then must be edited by the user later. It's difficult to explain, but this is happening because I have a Controller class which handles the NSTextField outlet, but a CollegeClass class which creates the objects. How can I tell the CollegeClass class to do... [self setClassName:[NSTextField stringValue]] if the NSTextField is an outlet designated in the Controller class? I tried importing the Controller header into the CollegeClass file, but it still doesn't recognize it.
Also, the Add button on the panel is linked to an NSArrayController that inserts the object. How can I have it do this and ALSO close the sheet?
Here's a pic!