Re: Editing text inside a grid
Re: Editing text inside a grid
- Subject: Re: Editing text inside a grid
- From: Fritz Anderson <email@hidden>
- Date: Fri, 29 Nov 2002 16:03:00 -0600
Text fields in general don't trigger program action until the user
indicates he's done with the field by tabbing out. This saves resources
and simplifies the UI, but makes for a headache in cases such as you
mention, where it doesn't make sense to the user to "tab out" of the
last field he edits.
The outline of the solution is this: Register as an observer for the
NSControlTextDidChangeNotification from your table. In the notification
code...
- (void) textDidChangeNotice: (NSNotification *) aNotice
{
NSDictionary * userInfo = [aNotice userInfo];
NSTextView * fieldEditor = [userInfo objectForKey: @"NSFieldEditor"];
NSString * currentString = [[[fieldEditor string] copy] autorelease];
/* ... */
}
... currentString is the current value of the text in the cell being
edited. I make a copy because the original is the active character
store of the table's text editor.
-- F
On Friday, November 29, 2002, at 04:05 AM, Prashanth Rao wrote:
I am unable to catch the text written inside the grid ( NSTableView )
without tabbing out. Unless I tab out, the text is not being picked up
in
my variable (i.e. the variable is not being set ). Is this some known
issue
or do we have a workaround for the same ?
I am using NSTextFieldCell to capture the text entered in the grid.
Any help would be appreciated,
Prashanth.
--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <
http://resume.manoverboard.org>
_______________________________________________
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.