[Drawkit] Undo not working for drawing / deleting objects

Graham Cox graham.cox at bigpond.com
Tue Jun 3 16:07:42 PDT 2008


Hi Brad,

Have you told the drawing what the undo manager is? You need to do  
that if you are not using the DKDrawingDocument class.

[myDKDrawing setUndoManager:[myDocument undoManager]];

I'd also advise you to use the DKUndoManager rather than the  
NSUndoManager. It's not essential, but for interactive editing it's a  
lot more efficient, since it coalesces consecutive tasks for the same  
property into one (otherwise e.g. dragging a shape to resize it might  
create tens or hundreds of undo tasks). In this case you also need to  
give the same undo manager object to your document/view as well.

cheers, Graham


On 4 Jun 2008, at 8:56 am, Brad Larson wrote:

> In our drawing program, I am able to load, save, and draw, as well  
> do the standard cut-and-paste, but the undo / redo actions don't  
> seem to work.  I must be missing something simple, but I can't seem  
> to track it down in my connections or code.  I've made the  
> DKDrawingView the first responder and connected the document's  
> m_mainView.  Is there something special I must do to set up the undo  
> manager or enable undo actions for the DKDrawing or DKDrawingView?
>
> ______________________
> Brad Larson
> SonoPlot, Inc.
> 3030 Laura Lane, Suite 120
> Middleton, WI 53562
>
>
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net



More information about the Drawkit mailing list