Re: separate undo manager for textview in document app
Re: separate undo manager for textview in document app
- Subject: Re: separate undo manager for textview in document app
- From: Andrew Merenbach <email@hidden>
- Date: Sun, 12 Dec 2004 16:47:34 -0800
Hello, Izidor. I don't know how helpful this will be for your case,
but the NSTextView also has two accessor methods:
- (BOOL)allowsUndo;
- (void)setAllowsUndo:(BOOL)flag;
The second method tells the text view that the text view has an undo
manager. You can set this flag in your code (with the method itself)
or from Interface Builder's inspector window, if you examine your text
view there.
Cheers,
Andrew
On 12 Dec 2004, at 04:47, Izidor Jerebic wrote:
Hello!
I have a document application, where a document also has a reference
to external file, and this file is displayed in a text view. I want to
have a separate undo manager for this view, so I implemented a
-undoManagerForTextView: delegate method, which creates a separate
undo manager.
Now, is there anything else I should do? Documentation is very scant
and suggests that this is everything.
I ask because undo is not working in this view. Menu items are
disabled...
But, when typing in this text view, my delegate method for undo
manager is being called. During menu validation, however, the
document's undoManager method is called, not the text view's (which
should be, since this text view is the window's first responder).
Any ideas how to solve this?
Has anybody else experienced something similar or should this just
work and I have some bugs?
izidor
P.S. Here are the stack traces. First during the typing:
#0 -[MyView undoManager] (self=0x6d42c40, _cmd=0x9089ca08) at ....
#1 0x92e67a14 in -[NSTextView(NSSharing)
shouldChangeTextInRange:replacementString:] ()
#2 0x92e23be4 in -[NSTextView insertText:] ()
#3 0x92e84578 in
-[NSKeyBindingManager(NSKeyBindingManager_MultiClients)
flushTextForClient:] ()
#4 0x92e3e5e8 in -[NSTSMInputContext interpretKeyEvents:] ()
#5 0x92ea15cc in -[NSView interpretKeyEvents:] ()
#6 0x92e3a7e0 in -[NSTextView keyDown:] ()
#7 0x92e034c4 in -[NSWindow sendEvent:] ()
#8 0x0122fe58 in -[MyWindow sendEvent:] (self=0x6d2e720,
_cmd=0x9088f8a4, anEvent=0x6d4e0e0) at .....
#9 0x92df54ec in -[NSApplication sendEvent:] ()
#10 0x01228d14 in -[MyApplication sendEvent:] (self=0x52d700,
_cmd=0x9088f8a4, anEvent=0x6d4e0e0) at ...
Then during the menu click:
#0 -[MyDocument undoManager] (self=0x6d131b0, _cmd=0x9089ca08) at ...
#1 0x92ea8640 in -[NSWindow _getUndoManager:] ()
#2 0x92e944f0 in -[NSWindow validateUserInterfaceItem:] ()
#3 0x92ed448c in -[NSWindow validateMenuItem:] ()
#4 0x92de7ae4 in -[NSMenu _enableItems] ()
#5 0x92e06c38 in -[NSMenu(carbonMenu_Private) _recursiveEnableItems]
()
#6 0x92e06c8c in -[NSMenu(carbonMenu_Private) _recursiveEnableItems]
()
#7 0x92e2eee8 in _NSHandleCarbonMenuEvent ()
#8 0x92dd2e44 in _DPSNextEvent ()
#9 0x92de9578 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#10 0x92dfd8e0 in -[NSApplication run] ()
#11 0x92eb9f00 in NSApplicationMain ()
#12 0x011aef74 in main (argc=1, argv=0xbffffd28) at
/Users/izidor/Projects/GoodPage/GoodPage/main.m:13
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden