[Drawkit] Undo not working for drawing / deleting objects
Brad Larson
larson at sonoplot.com
Fri Jun 20 14:22:32 PDT 2008
I figured it out. I needed to implement the delegate method
- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)sender;
{
return [self undoManager];
}
in my subclass of DKDrawingDocument, which is the delegate for my
document window. It's odd that this was not required for the DrawDemo
application.
On Jun 3, 2008, at 6:07 PM, Graham Cox wrote:
> 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
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562
More information about the Drawkit
mailing list