Re: NSTableView cell editing begin / end notifications?
Hi, All, As soon as I have no replies, I will try to reduce my problem scope... As far as I can see now, there are no suitable messages/notifications in standard Cocoa classes, which could serve, as notifiers of the cell editor session start/stop. I've found a code snipped, showing, how to create my own cell editor subclass: -(id) windowWillReturnFieldEditor:(NSWindow *)sender toObject: (id)anObject { if ([anObject isKindOfClass:[NSTextField class]]) { return [[[myCustomFieldEditor alloc] init] autorelease]; } return nil; } I've assigned my AppController, as the main window delegate, then created my own cell editor, as a derivative from NSTextView, and am trying to create it, as it is shown above. There is a problem - if operator, shown above, is never true. So, my cell editor is never created and the result of this method is always nil. Am I missing something? 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
Re: NSTableView cell editing begin / end notifications?
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
Re: NSTableView cell editing begin / end notifications - solved (?)
Hi, All, To whom is may be interesting: As I wrote initially, my problem is that the table is updated on a timer, so cell editor was cancelled automatically, as the timer fires. First I started to seek for a solution to learn about cell editor appearing / hiding events. And that was very hard way. Occasionally, walking through NSView methods I've found currentEditor method, resolving all my problem. Really, what I need to know, is whether cell editor is active or not. And the method, pointed above just shows it. Nevertheless I'd be just happy to learn about how to detect cell editor appearing / hiding. Though this question comes into a theoretical plane now. 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
NSTableView cell editing begin / end notifications?
Hi, All, In my app I have a table, populated by some periodic procedure, working on a timer. At the same time I need to add a cell editing capability. But periodic updating procedure calls [tableView reloadData], which resets the cell editor, if it is active. Therefore I need to stop this update procedure for a time, when cell editor is active. I've searched over the Net, but can't find any simple solution or description, how to catch editor appearance and hiding. Could anybody point me any sample or at least what notifications should I use? I don't like the idea to subclass a cell editor, but of course I'll do it (though don't know how to do it yet) if there will no other simpler solutions. 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