Re: Stop edit session with a NSTextField
Re: Stop edit session with a NSTextField
- Subject: Re: Stop edit session with a NSTextField
- From: Eric Gorr <email@hidden>
- Date: Mon, 23 Feb 2009 10:50:18 -0500
On Feb 23, 2009, at 10:44 AM, Patrick Mau wrote:
I had the same problem using a set of NSCell objects in one NSView.
You could try:
[[self window] endEditingFor:nil];
Unfortunately, that did not work.
This is described as a last resort to abort editing in the NSWindow
class reference.
It's not recommened, because you first need to save the textStorage
contents.
I ended up looking for the controlView using a loop to traverse
supervies:
[[self window] makeFirstResponder:nil];
NSView *v = fieldEditor;
while (v && ([v superview] != [self controlView]))
v = [v superview];
[v removeFromSuperview];
I am not sure I understand this.
Are you are saying is that you looked for the NSTextView being used as
the field editor for the NSTextField and then removed the NSTextView
from it's superview?
I tried this:
id fieldEditor = [[aNotification userInfo]
objectForKey:@"NSFieldEditor"];
[fieldEditor removeFromSuperview];
Unfortunately, it didn't work.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden