NSAlert
From GNUstepWiki
Revision as of 08:13, 15 April 2013; view current revision
←Older revision | Newer revision→
←Older revision | Newer revision→
This article or section is a stub (i.e., in need of additional material). You can help us by expanding it |
---|
NSAlert is a modal dialog or sheet.
<syntaxhighlight lang="c_max">
/** NS Alert Example*/
NSAlert* a = [ NSAlert alertWithMessageText:@"title" defaultButton:@"ok" alternateButton:@"cancel" otherButton:nil informativeTextWithFormat:@"more information ];
//Run as a dialog NSInteger returnCode = [a runModal]; switch(returnCode) { case 1:
//ok break;
case 2:
//cancel break; }
//Attach to window [a beginSheetModalForWindow:windowP modalDelegate:self didEndSelector:@selector(alertDidEnd:) contextInfo:nil];
- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { switch(returnCode) { case 1: //ok break; case 2: //cancel break; } } </p>
</syntaxhighlight>
[edit]