Re: Several Cocoa questions
Re: Several Cocoa questions
- Subject: Re: Several Cocoa questions
- From: Isaac Sherman <email@hidden>
- Date: Wed, 27 Feb 2002 13:47:48 -0500
on 2/27/02 1:19 PM, you, Chad Armstrong, at the address, email@hidden,
wrote:
>
Hello,
>
>
I'm fairly new to Cocoa development, and I have several questions which
>
I hope can make my small application I'm working on, run a little
>
smoother.
>
>
1) Closing the app from a button - If there is an Off or Close button in
>
the program window, what code is necessary to tell the program to shut
>
down? In Java, this would be fairly simple with a command like:
>
>
System.exit(0);
>
>
But I am using just Objective-C Cocoa, no Java.
>
In IB, just connect the button to First Responder->terminate. Or, you can
have it connect to an action of a custom class, and in the method call
[NSApp terminate:self].
>
2) How can I create multiple instances/windows of my program? Do I just
>
create a function which allocates a new instance of the program and that
>
handles most of the problems?
Are you referring to a doc-based setup?
>
3) When the last window of the program is closed, what code is necessary
>
to tell the entire program to shut down? Also, how would I link in this
>
information to my interface, if necessary?
I'd look at the notifications in NSWindowController. As for the code, see
#1.
HTH,
--
Isaac Sherman
MotaSoft Software
_______________________________________________
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.