• 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: Challenge 2 in Chapter of A. Hillegass's Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Challenge 2 in Chapter of A. Hillegass's Book


  • Subject: Re: Challenge 2 in Chapter of A. Hillegass's Book
  • From: George Greene <email@hidden>
  • Date: Sat, 5 Nov 2005 06:44:07 -0500

thanks,

ok, i think i've got it. i have to read the section File's Owner section again, and maybe again. :-)

i went to the homepage. clicked on products. clicked on the book. i didn't see a reference to this page. hey, i really appreciate the help, and the link.

thanks again,

g.
On Nov 5, 2005, at 5:26 AM, Hanspeter Spalinger wrote:


Am 02.11.2005 um 11:44 schrieb George Greene:

hi,

i'm reading "Cocoa Programming For Mac OS X". in chapter 9, the author ask us to create another nib file for a custom "About" panel.

i need a little help. i created the nib fie, but i don't see how to connect it or how to have it display itself when the user clicks on the About Application.

i know i'm missing something.
does the AppController need a AboutController?
does the AppController need a method that would show the About panel?

i tried something like this:

#import <Cocoa/Cocoa.h>
@class PreferenceController;
@class AboutController;

@interface AppController : NSObject{
      PreferenceController   *preferenceController;
      AboutController           *aboutController;
}
     -(IBAction)showPreferencePanel:(id)sender;
     -(IBActon)showAboutPanel:(id)sender;

@end

You are on the right way ;-) (your'e not stupid)


i saved and then dragged the AppController.h into the MainMenu.nib. i thought at this point there would be some connection for me to make, but there was not.
You have to connect the About NewApplication in he Menu to target to the showAboutPanel action in the mainMenu.nib.
Generaly : If you think there should be a connection you usualy need one :-) If you can't find something in IB, you miss something.

ok, that thought was wrong.
using Interface Builder, i created the new nib, but i don't see any way to get the response i'm looking for, clicking the About Application in the Application menu and having it display the custom About panel.


does AppController need to know about the AboutPanel? i'm lost a bit, ok a lot.
Not realy.
I've created a AboutBoxController class exact the same way like the PreferencesController class. (AppController creates it at first call, and then calls the show method on the AboutBoxController).
The AboutBoxController ist then (like the PreferencesController ) the File's Owner of the AboutBoxNib.


When I did that example, I did it a bit too fast, and tried to load the aboutBox nib directly from the AppController , setting it as the File's Owner.
It doesn't worked, and I was lost too ;-)


But the point is to set up the File's Owner correctly with it's own controller.

Indeed you can do it without a AboutBoxController. just load the aboutBox when the showAboutBox method is called and then call the
makeKeyAndOrderFront method. If you don't wan't to load it everyTime you have to hold it with a instance in AppController, and call its makeKeyandFront everyTime the showAboutbox is called. It's in fact the same you do when creating a AboutBoxController (or the PreferencesController). (Don't forgett to set up File's Owner!)


I think it's better to create the AboutBoxController, cause you get a cleaner object-tree. I think it's best to always create a controller class for every nib you create (and set it to be the file's owner!) then it will too be cleaner to understand the application. You can then always use the File's Owner as a link to the outer World (Thats what it is for?).

thanks for any help you can give to get me on the right thought path.
if you can, please, point me to a reference that might help, another book, apple documentation page, etc.

You realy should look at the book's homepage if you didn't have. There are solutions and readers comments, diskussions and more.


greetings HP


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Challenge 2 in Chapter of A. Hillegass's Book (From: George Greene <email@hidden>)

  • Prev by Date: Re: NSTable Examples
  • Next by Date: opening 'greyed out' files
  • Previous by thread: Re: Challenge 2 in Chapter of A. Hillegass's Book
  • Next by thread: CFBundleGetInfoString?
  • Index(es):
    • Date
    • Thread