From: Steven D. A. <st...@ne...> - 2009-01-26 19:48:17
|
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 |