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: NSTextFieldCell "challenge"




On 2004-12-17, at 10.30, Geert B. Clemmensen wrote:

I have a subclassed NSControl that among other things hold a NSTexFieldCell (textCell). When editing of the the cell, using the standard field editor, is ended, this textDidEndEditing: method gets invoked:

- (void) textDidEndEditing:(NSNotification*) notification
{
   NSTextView* e   = [notification object];
   NSString*   str = [NSString stringWithFormat:@"%@", [e string]];

   [textCell setStringValue:str];
   [textCell endEditing:e];

   NSLog(@"New  textCell=%@", [textCell stringValue]);

   [e setString:@""];

   NSLog(@"Done textCell=%@", [textCell stringValue]);

   ...
}

The spooky part, or at least so I believe, is the [e setString:@""] call, i.e. the field editor contents is supposedly cleared, BUT the textCell's string value is ALSO cleared (actually it is set to the same value as the field editor is set to). Here is NSLog output (editing the text cell twice)

First of all, why do you reset the value of the field editor?

j o a r

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >NSTextFieldCell "challenge" (From: "Geert B. Clemmensen" <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.