Does textDidEndEditing lunches other class methods?
Does textDidEndEditing lunches other class methods?
- Subject: Does textDidEndEditing lunches other class methods?
- From: Lorenzo Puleo <email@hidden>
- Date: Fri, 15 Nov 2002 22:02:38 +0100
Hi,
I made a NSTextField subclass "MyTextField" which is the delegate of a
NSTextField field.
When the users presses TAB during the editing, so he exits from the field, I
want to launch a method of another class. e.g.
- (void)textDidEndEditing:(NSNotification *)aNotification
{
[super textDidEndEditing:aNotification];
NSLog(@"Check Done");
[MyMainClass saveToDisk];
}
But it doesn't work. I see the log string "Check Done", but I cannot launch
that MainClass method. I need to launch that method because most of the
variables and objects I need to control are stored in that class.
May someone help me? Thank you.
This is the header:
===================
/* MyTextField */
#import <Cocoa/Cocoa.h>
@interface MyTextField : NSTextField
{
}
@end
This is the code:
===================
#import "MyTextField.h"
#import "MyMainClass.h"
@implementation MyTextField
- (id)init
{
self = [super init];
return self;
}
- (void)textDidEndEditing:(NSNotification *)aNotification
{
[super textDidEndEditing:aNotification];
[MyMainClass saveToDisk];
}
@end
This is the code of the MainClass:
===================
- (void)saveToDisk
{
[[myField objectValue] writeToFile:@"/txt" atomically:YES];
}
What is wrong?
--
Lorenzo
mailto:email@hidden
_______________________________________________
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.