Skip navigation.
 
mlRe: Editing text inside a grid
FROM : Fritz Anderson
DATE : Fri Nov 29 23:03:00 2002

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_removed>>
Risumi:    <http://resume.manoverboard.org>
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlEditing text inside a grid Prashanth Rao Nov 29, 11:05
mlRe: Editing text inside a grid Fritz Anderson Nov 29, 23:03