Re: Trying again: how to implement textShouldEndEditing for NSTableView?
Re: Trying again: how to implement textShouldEndEditing for NSTableView?
- Subject: Re: Trying again: how to implement textShouldEndEditing for NSTableView?
- From: Matt Ridley <email@hidden>
- Date: Fri, 22 Jun 2001 21:54:34 +0100
On 22/6/01 7:08 pm, Matt Ridley <email@hidden> wrote:
>
I have an NSTableView, with the same object set as its delegate and
>
dataSource. All is working fine.
>
>
However, I need to detect when a user is about to end editing a cell; I need
>
to implement the textShouldEndEditing method in the NSTableView's "text
>
delegate" (according to the NSTableView documentation).
>
>
I've tried implementing this method in the object which is my NSTableView's
>
delegate and dataSource, but it never gets called. I also tried making that
>
same object the window delegate for the window which contains the table, but
>
again the method never gets called. I've tried this with my own projects and
>
with the simple NSTableView examples from Learning Cocoa (using the source
>
from O'Reilly), so it doesn't seem to be a peculiarity of my projects.
I seem to have solved the problem, but I'm not entirely sure why my original
code doesn't work. The NSTableView documentation says I should implement
this method:
- (BOOL)textShouldEndEditing:(NSText *)textObject
But that doesn't work, as I said. So, I looked up the NSControl
documentation, and instead implemented its equivalent method in my table
delegate:
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText
*)fieldEditor
Which does indeed work as desired. Now all I need is to understand why the
first method doesn't work. :-) Any thoughts would be appreciated!
--
// Matt
- (void)sendMeEmail {
[[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:@"
mailto:email@hidden"]];
}