Hi Eric

I was going through your last messages on this list, because I'm working on a similar problem. Reading through the code snippets you showed here, it isn't clear to me how your controls are being created.

Are you creating a subclass of NSControl and afterwards add your GUI elements as sub-views programatically? I could not figure out if you use one NSControl with NSCell's, sorry if I missed it.

[snip]

Unfortunately, it does not work either.

If anyone has any further ideas on how to correctly end an editing session of a NSTextField, I am interested.

To summarize the proposed and failed solutions:

*** [[[self view] window] endEditingFor:nil];

Pressing return or pressing the tab key will not end the editing session

As far as I understand, TAB will focus the next control using the responder chain. It is not really remove the editor, because you could TAB back to your control/cell
and still have the same state for editing.


*** [[[self view] window] makeFirstResponder:[self view]];

Pressing return will allow the editing session to end, but pressing the tab key will not.

I would suggest you write a small debug function to output the responder chain. Call it after all your elements are setup and again after you started editing.


*** NSTextView *fieldEditor = [[aNotification userInfo] objectForKey:@"NSFieldEditor"];
   NSView *v = fieldEditor;
   while ( v && ( [v superview] != [aNotification object] ) )
   v = [v superview];
   [v removeFromSuperview];

Pressing return or pressing the tab key will not end the editing session

It works for me using one NSView only drawing NSCell objects.
But it was only a hack I tried to remove the field editor.

What happens when you NSLog all views you traverse on your way up?
Could you send the output?

The editing session was started with:

[textField selectText:nil];                     

This is a complete NSTexyField added as a subview to your NSControl, not a NSTextFieldCell? Could you tell a bit more about how your abjects are created/setup, if you don't mind?

I'm asking because I work on a similar problem, implementing one
NSView class drawing multiple (editable) NSCell objects.

Regards
Patrick
_______________________________________________

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