Re: applicationShouldTerminateAfterLastWindowClosed Document-based Project Help?
Re: applicationShouldTerminateAfterLastWindowClosed Document-based Project Help?
- Subject: Re: applicationShouldTerminateAfterLastWindowClosed Document-based Project Help?
- From: Bill Hernandez <email@hidden>
- Date: Tue, 23 Mar 2010 13:20:57 -0500
On Mar 23, 2010, at 12:27 PM, Quincey Morris wrote:
> There's quite a lot of flailing going on here. If something goes wrong, randomly trying to solve a different problem isn't a great strategy.
You are absolutely right on every one of your points, really on the money. I've been trying to learn Cocoa over the past three months, and every time I think I am making headway, I run into a problem and there's nobody locally to ask. I've bought several books on Cocoa, and have been trying to read them but my impatience gets the better of me, and I want to build stuff for which I am not equipped yet. I should do more reading and less coding...
> You have an IB *usability* problem. That is, you tried to do something in IB and it didn't behave as expected. [As a consequence, your application has no delegate, and therefore -- of course -- the application delegate method applicationShouldTerminateAfterLastWindowClosed doesn't get called.]
>
> So, back to IB. You don't say *which* nib you added your AppController instance to. My guess is that you're trying to do this in a document window nib (where File's Owner is of type NSDocument or NSWindowController) instead of the main menu nib. If that's not it, then what is the class of File's Owner? If you select File's Owner and display the Connections tab of the IB inspector, can you drag from the circle next to the 'delegate' outlet to your AppController object? To any object at all?
I had a severe misconception, which is that I didn't realize that I should be creating the AppController in the MainMenu nib. I honestly thought that MainMenu.xib was only for the menus. I had no clue that I should have put the AppController there, I was working with the NSDocument nib. Now it all makes sense. What an enlightening event...
> Also, this is not what you were asking about, and really none of my business, but why on earth do you want a document-based app to close after its last window closes? It denies the user the opportunity to open or create a new document.
You are absolutely right ! The only reason for the applicationShouldTerminateAfterLastWindowClosed was to save me a step every time I used Build and Run and then closed a window. Instead of doing s CMD-Q, or clicking on the red Tasks button to get back to the project, I just started putting a Done button, it was just as a matter of convenience while I am trying to proceed on the learning curve. I had not even considered, or thought about the user yet. I am still in the totally confused stage, every time I think I am making headway, I realize I am not...
> Also, regarding your original non-document-based project, even if it was just a throw-away exercise, don't label your button "DONE". I mean this is torturing kittens, or worse. Mac buttons (except for "OK") aren't in uppercase, and the button label should say what it's going to do. "Quit" would have been perfect for this application, I suspect, and just as easy for you to type. :)
You are right once again, I had actually written the message using Done, instead of DONE, the first time I posted it, but I was really trying to draw attention to the button so I changed it to DONE.
I had posted a number of questions on another forum, and never got much in the way of replies. Sometimes days would go by, and I could tell that many people had read the posts, but no replies were forthcoming. Sometimes it got pretty discouraging, and a couple of days ago I found out about this forum, and this was my first post.
Thank You very much for taking the time to provide your insights and help...
Bill Hernandez
Plano, Texas
http://www.journey-of-flight.com
_______________________________________________
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