• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView cell editing begin / end notifications?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView cell editing begin / end notifications?


  • Subject: Re: NSTableView cell editing begin / end notifications?
  • From: Alexander Bokovikov <email@hidden>
  • Date: Tue, 28 Jul 2009 22:07:41 +0600

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 (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


  • Prev by Date: Re: Panning a View
  • Next by Date: Making NSTextView not wrap lines
  • Previous by thread: Re: NSTableView cell editing begin / end notifications?
  • Next by thread: How to set the string and integer value of an NSButtonCell using NSOutilneView
  • Index(es):
    • Date
    • Thread