Re: Message dialog on Cocoa
Re: Message dialog on Cocoa
- Subject: Re: Message dialog on Cocoa
- From: ∞ <email@hidden>
- Date: Fri, 20 Jul 2007 12:52:05 +0200
Il giorno 20/lug/07, alle ore 12:40, Felipe Monteiro de Carvalho ha
scritto:
You're calling this from another thread, right?
No, I'm calling from the main thread. But consider that there is
nothing else on the software, just a call to this function (and some
calls to build the strings).
This should work (be sure to make the file a .m Objective-C source
file, and that all frameworks are correctly imported in the Xcode
project):
#import <Cocoa/Cocoa.h>
int main (int argc, const char* argv[]) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSRunAlertPanel(@"This is the title", @"This is the message", nil,
nil, nil); /* uses a default "OK" button and no alternate buttons */
[pool release];
return 0;
}
Also note that NSRunAlertPanel does NOT return an error status. Cocoa
functions return results, not status codes, and have alternate
(better-structured) means of returning exceptional situations, such
as exceptions and NSError instances.
Make sure you read the docs and/or follow a few tutorials before
diving into Cocoa/Objective-C, as it's a very different way of
writing software when compared to procedural world of Carbon.
- ∞_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden