resignFirstResponder called immediately
resignFirstResponder called immediately
- Subject: resignFirstResponder called immediately
- From: Donald Hall <email@hidden>
- Date: Wed, 7 Apr 2004 00:29:59 -0600
I have subclassed NSTextField so that I can override
becomeFirstResponder and resignFirstResponder. In my test code it
seems that resignFirstResponder is being called immediately after
becomeFirstResponder even though my text field still is the first
responder (has focus ring and accepts keystrokes).
Here is my code:
#import <Cocoa/Cocoa.h>
@interface MyPathTextField : NSTextField {
}
-(BOOL)becomeFirstResponder;
-(BOOL)resignFirstResponder;
@end
#import "MyPathTextField.h"
@implementation MyPathTextField
-(BOOL)becomeFirstResponder {
NSLog(@"becomeFirstResponder");
return [super becomeFirstResponder];
}
-(BOOL)resignFirstResponder {
NSLog(@"resignFirstResponder");
return [super resignFirstResponder];
}
When I tab into one of these text fields I get both messages:
2004-04-07 00:02:22.712 MyApp[8922] becomeFirstResponder
2004-04-07 00:02:22.740 MyApp[8922] resignFirstResponder
When I tab out, I get no messages.
The panel containing the text field remains key (frontmost).
Can anyone explain this? It looks like I am doing the same thing as
in Anguish et al page 586.
Thanks,
Don
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
email@hidden
http://www.appsandmore.com
_______________________________________________
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.