Re: NSTableView usage and Generating Events from within Cells
Re: NSTableView usage and Generating Events from within Cells
- Subject: Re: NSTableView usage and Generating Events from within Cells
- From: Danny Swarzman <email@hidden>
- Date: Fri, 3 Oct 2003 03:41:59 -0700
At 15:12 -0700 10/2/03, T Ingham wrote:
>
Good Afternoon,
>
>
I'm trying to perform a relatively simple thing and having a terribly
>
complicated time with it. Some of you might recognize this issue from
>
the PB list, and I apologize for cross-posting, I didn't realize there
>
was a list for cocoa specifically until later in the day.
>
>
The behavior I am attempting to produce:
>
When the user types in a cell within an NSTableView, I want to know
>
what is being typed.
>
>
The process I have followed thus far:
>
I have created a window that contains an NSTableView.
>
I create a datasource object and make this DS my dataSource for the
>
NSTableView,
>
as well as the delegate for the TableView.
>
I can receive event information for the NSTableView pertaining to
>
keyDown,
>
but once I enter the cell itself, I lose the ability to know what has
>
been typed.
>
>
The problem that I think would solve the issue:
>
There is the method: - (void)textDidEndEditing:(NSNotification
>
*)aNotification; which I have implemented in MyDataSource, which should
>
be NSLog[ing] "End Edit" when the user hits return in the cell, but for
>
some reason this event is not exposed to MyDataSource for delegation (
>
or rather it's not being called when I stop editing the cell).
>
I know that NSCell ( or more specifically NSTextFieldCell ) can tell
>
me that editing has ceased, but I don't know how to insert a subclass
>
of that particular item into my table. I think that this might be the
>
wrong approach regardless, as it seems like the NSTableView should know
>
when a cell edit has stopped, or when a key has been pressed in one of
>
it's columns->cells->text fields.
>
>
>
Someone [Thanks Jonathan] also suggested that an NSFormatter might
>
work, although I don't really care about the contents of the cell, just
>
whether or not the return key was pressed, ( or perhaps cmd+delete in
>
the future.. )
>
>
Thanks for any help,
>
>
-Thomas
You can define in MyDataSource:
- (void)tableView:(NSTableView *)aTableView
setObjectValue:(id)anObject
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
It's kind of symetric with:
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn*)aTableColumn
row:(int)rowIndex
A source is a sink too.
-Danny
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.