Skip navigation.
 
mlRe: Validating Input from Sheet
FROM : Hasan Diwan
DATE : Fri Jan 10 21:58:20 2003

[NSApp beginSheet:window modalForWindow:[NSApp keyWindow]
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo)
contextInfo:nil];
...
- (void)sheetDidEnd:(NSWindow *)w returnCode:(int)rc contextInfo:(void
*)n {
   if ([[[window textField] stringValue] isEqualToString:@""]) {
       NSRunCriticalAlertPanel(NSLocalizedString(@"sheetFailedTitle",
@"sheet has failed") NSLocalizedString(@"sheetFailedMessage", @"foo bar
baz"), NSLocalizedString(@"Ok", @"Ok"), nil, nil);
       [NSApp terminate:nil];
   }
   string = [[window textField] stringValue];
}
Hope that helps!
On Friday, January 10, 2003, at 07:44  AM, Jeff LaMarche wrote:

> I've got a sheet that I use to get information from the user. When
> they hit okay, I want to do some validation. When an error condition
> is found, I'm currently doing another sheet, but this somehow feels...
> dirty. Is there a better way, or is it okay to do a
> sheet-within-a-sheet for validation?

Hasan Diwan
OpenPGP KeyID: 0x7EE3855B
Fingerprint: 42F0 5758 C3EB BA1F ABD2  ED49 3390 CCF0 7EE3 855B
http://www.cs.rpi.edu/~diwanh/gpg.key

[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlValidating Input from Sheet Jeff LaMarche Jan 10, 16:44
mlRe: Validating Input from Sheet Hasan Diwan Jan 10, 21:58