From: Jonathan P. <jp...@dc...> - 2005-06-04 23:23:59
|
On 4 Jun 2005, at 23:39, Dave Howell wrote: >> I usually name my outlets indicating what they're connected to - >> for example: "taskTitleField". >> > > An interesting hybrid. I'd been naming them by function, which > would be "taskTitle." To name them by recipient would be > "NSTextField" or the like. My solution was to just call it "title", > which doesn't match "setTaskTitle." With bindings you often don't need an outlet for the text field at all. You just have an NSString in your object bound to the text field - Cocoa Bindings takes care of keeping the text field in sync with the string. Furthermore, if you change the value of your string variable through a call to (for example) your setTitle, the Key Value Observing system notifies the text view and keeps it up to date. This doesn't quite happen automatically in RubyCocoa (due to implementation details), but can be made to work very naturally with a little extra code, which I've posted to the list about before. >> I'm afraid, however, that it's probably worth working through the >> one of the Objective C examples first. > > Er, one of which Objective C samples? An example for Cocoa Bindings (found using Google): http://www.cocoadevcentral.com/articles/000080.php also, from Apple (again via Google): http://developer.apple.com/documentation/Cocoa/Conceptual/ CurrencyConverterBindings/01introduction/chapter_1_section_1.html There are lots of ready-to-look-at Objective C examples here: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html |