Hi, All,

I'm sorry for flood, it's all is pretty new for me, therefore I do too many mistakes...

Here is, what I'm trying to do:

- (id) windowWillReturnFieldEditor:(NSWindow *)sender toObject: (id)anObject {
        MyTitleEditor *ed;
        
        if ([anObject isKindOfClass:[NSTextField class]]) {
                ed = [[[MyTitleEditor alloc] init] autorelease];
                [ed setDelegate:self];
                return ed;
   }    
   return nil;  
}

As far as debugger shows it, this procedure is called for every control in my main window. I don't understand it why, but it is called twice for every control, if I understand it correctly.

OK, the IF operator is true for some objects like text field (a label), but not only for the NSTableView cell editor. So, first of all I need to distinguish somehow, when this procedure is called for the table cell editor. How to do it? What is the "TextField" object at the moment, when this method is called for the table cell editor?

Another question is that my approach with the NSTextView subclassing seems to be not working. What I wrote, is this:

in .h file:

......................
@interface MyTitleEditor : NSTextView {

}

- (BOOL)acceptsFirstResponder;
- (BOOL)becomeFirstResponder;
- (BOOL)resignFirstResponder;

@end

in .m file:
.........................

- (BOOL)acceptsFirstResponder {
        return [super acceptsFirstResponder];
}

- (BOOL)becomeFirstResponder {
        if(([self delegate] != nil) &&
([[self delegate] respondsToSelector:@selector(cellEditorWasActivated:)]))
                [[self delegate] cellEditorWasActivated:self];
        return [super becomeFirstResponder];
}

- (BOOL)resignFirstResponder {
        if(([self delegate] != nil) &&
([[self delegate] respondsToSelector:@selector(cellEditorWasDeactivated:)]))
                [[self delegate] cellEditorWasActivated:self];
        return [super resignFirstResponder];
}

None of these methods is called when I click in the NSTableView cell. Editor appears, but I suppose, it's somehow not my customized editor, but just generic cell text editor.

Where is my mistake?

Thanks.

_______________________________________________

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