From: Brian M. <ma...@ex...> - 2009-01-28 23:46:02
|
I'm confused by the Objective-C version. It doesn't have the MyDocument.m method startObservingPerson (on p. 146 of Hillegass). It shouldn't work without setting up observing. (I can't check - won't build in my older version of Xcode.) Am I looking at the wrong pages? On Jan 26, 2009, at 1:24 PM, Steven D. Arnold wrote: > Following up on my previous post related to the "raiseman" > application covered in Aaron Hillegass's Cocoa Programming for Mac > OS X..... I implemented the same program in Objective-C, an > identical analogue to the program in Ruby, and it works fine in > Objective-C. That is, the expected methods to insert and remove > "employee" objects (see below) are called in Obj-C but not > RubyCocoa. That tells me there is a bug in the RubyCocoa interface > that prevents key-value coding from working properly.....or possibly > I am missing some detail in my implementation of the RubyCocoa > program. The Objective-C project which works fine is attached. Run > the program, and then add several records and undo them by typing > command-Z (or selecting undo from the Edit menu). If you do this, > the key-value coding will work fine, that is, the following methods > will be called to undo and redo: > > - (void)insertObject:(Person *)p inEmployeesAtIndex:(int)idx > - (void)removeObjectFromEmployeesAtIndex:(int)idx > > The equivalent methods in the Ruby implementation are not called: > > def insertObject_inEmployeesAtIndex(p, index) > def removeObjectFromEmployeesAtIndex(index) > > I have also tried these Ruby methods with a trailing _ just to be > sure that's not the problem. It didn't change the result. > > steven > > > <raiseman-objc.zip> > > > > > On Jan 24, 2009, at 11:33 PM, Steven Arnold wrote: > >> Hello, I am working through the book Cocoa Programming for Mac OS X >> by Aaron Hillegass using RubyCocoa rather than Objective-C, and I >> am at the section where we are attempting to implement undo for the >> add new employee and delete new employee buttons. >> >> My controller object as an @employees array as a member value. >> Given this name, I have implemented, in my controller, the functions: >> >> insertObject_inEmployeesAtIndex(p, idx), and >> removeObjctFromEmployeesAtIndex(idx) >> >> According to the book, "[...] these methods will be called >> automatically when the NSArrayController wishes ro insert or remove >> messages." However, my functions do not seem to be getting >> called. I have put NSLog statements to see whether they are being >> called, but right now it appears not. >> >> My project is packaged below. If you have any idea what I might be >> doing wrong, please let me know! >> >> eteven >> >> >> <raiseman.zip> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword_______________________________________________ >> Rubycocoa-talk mailing list >> Rub...@li... >> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword_______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk ----- Brian Marick, independent consultant Mostly on agile methods with a testing slant www.exampler.com, www.exampler.com/blog, www.twitter.com/marick |