[MacRuby-devel] Implementing Undo In RaiseMan / MacRuby

Benjamin Stiglitz ben at tanjero.com
Tue Oct 27 09:23:10 PDT 2009


>   def insertObject(p, inEmployeesAtIndex:index)
>     NSLog("adding #{p} to #{employees}") # <= Not called, huh?
>     undo = @undoManager
>     undo.prepareWithInvocationTarget(self,  
> removeObjectFromEmployeesAtIndex:index)
>     if !undo.isUndoing
>       undo.setActionName("Insert Person")
>     end
>     employees.insertObject(p, atIndex:index)
>   end

FWIW, the third line of the body should read
undo.prepareWithInvocationTarget(self).removeObjectFromEmployeesAtIndex 
(index)

-Ben


More information about the MacRuby-devel mailing list