Delegate methods not working...
Delegate methods not working...
- Subject: Delegate methods not working...
- From: James McConnell <email@hidden>
- Date: Fri, 05 Mar 2004 21:00:39 -0600
Hey all, it's me again ;-). I have a doc based app with several text
fields. In IB, I've connected each NSTextField to File's Owner
(MyDocument), and set MyDocument as each fields delegate. In MyDocument.m,
I've implemented the following method which checks the value of the text
field. Everything compiles fine, but when I change text fields without
entering an value, I do not get the NSAlertPanel like I expect. Can anyone
see anything wrong? I've searched the list archives as well as
cocoa.mamasam.com, and found nothing helpful.
<start code>
- (BOOL)control:(NSControl*)control
textShouldEndEditing:(NSText*)fieldEditor
{
if ([[control stringValue] isEqualToString:@""])
{
NSRunAlertPanel(@"Empty field", @"Please enter a value.", @"OK",
nil, nil);
return NO;
}
[recipeController updateRecipe]; // simply updates a model object
return YES;
}
<end code>
Now, this is what was suggested by Ryan Bates in an earlier conversation
(thanks again, Ryan!), but it's not working. I had this working with
notifications, but everytime a notification was fired for one text field, it
would fire every notification for all the text fields. Besides, I need
notifications to do something else, and would like to get this to work so I
can keep notifications for their other job. Thanks again for all the help.
James
_______________________________________________
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.