What is a Field Editor (and why does it hate me!)
What is a Field Editor (and why does it hate me!)
- Subject: What is a Field Editor (and why does it hate me!)
- From: Richard Schroedel <email@hidden>
- Date: Mon, 27 Jan 2003 12:02:02 -0600
I'm having an odd problem. I've found a simple workaround, but I really
want to know what's going on.
I have an application that has window that contains a NSTabView. One
of the NSTabViewItem's contains, among other things, a NSTextView. The
contents of the window are created programatically.
To demonstrate the problem
1. Enter text in the aforementioned NSTextView.
2. LEAVE THE CURSOR IN THE TEXT FIELD
3. Click on a different tab.
4. Click on the origional tab.
At this point the NSTextView has dissappeared. Dumping the view
structure in the window discloses that the NSTextView has actually been
removed from the view that enclosed it. Clearly this involves the first
responder.
I placed a breakpoint
b -[NSTextView removeFromSuperview]
When repeating the above steps, step 3., (Click on a different tab),
triggered the breakpoint. Doing a backtrace gave
#0 0x9314b3e4 in -[NSTextView(NSSharing) removeFromSuperview] ()
#1 0x9313e218 in -[NSWindow endEditingFor:] ()
#2 0x9311393c in -[NSView replaceSubview:with:] ()
#3 0x931448a0 in -[NSTabView
_switchTabViewItem:oldView:withTabViewItem:newView:initialFirstResponder
:lastKeyView:] ()
#4 0x9313649c in -[NSTabView selectTabViewItem:] ()
#5 0x00072c74 in -[MyTabView selectTabViewItem:] (self=0x65b0a0,
_cmd=0x906ce578, theItem=0x14e11a0) at
MyTabView.m:62/Users/rich/FreestyleWO/
#6 0x932026f8 in -[NSTabView mouseDown:] ()
#7 0x930c0888 in -[NSWindow sendEvent:] ()
#8 0x930a8788 in -[NSApplication sendEvent:] ()
#9 0x930b1608 in -[NSApplication run] ()
#10 0x9315f6b8 in NSApplicationMain ()
#11 0x0006f6bc in main (argc=1, argv=0xbffffc8c) at
FreestyleA_main.m:6/Users/rich/FreestyleWO/
#12 0x00003c5c in _start (argc=1, argv=0xbffffc8c, envp=0xbffffc94) at
/SourceCache/Csu/Csu-45/crt.c:267/SourceCache/Csu/Csu-45/
#13 0x00003adc in start ()
Looking up the method, endEditingFor, in NSWindow suggests a concept
called "field editor" is involved. The documentation for the "field
editor" I have found makes no sense to me. Could someone explain why a
view object I have created is being deleted?
A simple workaround is to insert code to make the window itself the
first responder before the method call [NSTabView selectTabViewItem:].
But I still don't understand when the NSTextView is beling deleted!!!!
Rich Schroedel "There is only one success...
Ondossagon Software to live your life in your own way"
email@hidden Christopher Marlowe
_______________________________________________
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.