• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Message dialog on Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Message dialog on Cocoa (From: "Felipe Monteiro de Carvalho" <email@hidden>)
 >Re: Message dialog on Cocoa (From: ∞ <email@hidden>)
 >Re: Message dialog on Cocoa (From: "Felipe Monteiro de Carvalho" <email@hidden>)
 >Re: Message dialog on Cocoa (From: ∞ <email@hidden>)
 >Re: Message dialog on Cocoa (From: "Felipe Monteiro de Carvalho" <email@hidden>)
 >Re: Message dialog on Cocoa (From: Alastair Houghton <email@hidden>)
 >Re: Message dialog on Cocoa (From: "Felipe Monteiro de Carvalho" <email@hidden>)

  • Prev by Date: Re: Message dialog on Cocoa
  • Next by Date: set modification date of symlink
  • Previous by thread: Re: Message dialog on Cocoa
  • Next by thread: set modification date of symlink
  • Index(es):
    • Date
    • Thread