Re: missing textDidEndEditing: NSTextView delegate messages
Re: missing textDidEndEditing: NSTextView delegate messages
- Subject: Re: missing textDidEndEditing: NSTextView delegate messages
- From: Alex Rice <email@hidden>
- Date: Mon, 18 Nov 2002 02:00:33 -0700
On Saturday, November 16, 2002, at 02:03 AM, Alex Rice wrote:
I could use some ideas for debugging this one!
The scenario: I have an NSTextView and it's delegate is my NSDocument
class. The NSTextView is originally in a NSDrawer, but I swap the
contentView of the drawer into a Panel, and back into the drawer. It's
a tear-off inspector thingy.
The problem: Delegate method textDidEndEditing: does not get called
when the NSTextView is in the Panel. textDidEndEditing: does get
called when it's in the Drawer. The delegate never changes; it's the
same object throughout.
What's strange about it is that textDidChange: does get called no
matter whether the NSTextView is in the drawer or the panel. Leaving
me with the workaround below. Does anyone have any ideas where I
messed up, or could this be a Appkit bug?
[answering own post]
Here is a solution I came up with. It works, but it seems not to be
very elegant, which makes me think I'm using AppKit incorrectly; why
won't my NSTextView just send a textDidEndEditing: message without my
having to catch the change in key windows? It's as if the key window
change happens before the NSTextView has a chance to notice. It doesn't
send the delegate message or the notification message for
textDidEndEditing:.
-(void) windowDidResignKey: (NSNotification *)aNotification
{
if([aNotification object] == inspectorPanel)
{
if(! [inspectorPanel makeFirstResponder: inspectorPanel])
[inspectorPanel endEditingFor:nil];
}
} // windowDidResignKey:
Alex Rice <email@hidden>
Mindlube Software
http://mindlube.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.