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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to