Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing text inside a grid



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.

References: 
 >Editing text inside a grid (From: "Prashanth Rao" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.