On Dec 8, 2008, at 8:40 AM, XiaoGang Li wrote:

Thanks. I have read these references, but I still have no idea about my issue, Maybe I did not understand them completely now, but I am worried that maybe I have not give a clear expression in my first email. Maybe I need
give a more detailed description:

this application is a utility for my printer, which be launched
by the utility button on the Printer Setup Center. when user click the
utility button, the Mac OS X will launch the linked application. and the application should first register an apple event, the Mac OS X then will send the apple event which used to tell my utility the printer model name
and related information about the device. So, before the appliction be
launched, it should get the apple event and check the printer name, then it will load the nib file dependently. If the printer is a USB printer, it will load a normal window to interact with user, if it is a Network, it will
launch another application to do other things.

           So, I have no idea to design this application. I think this
question maybe can not be implemented by cocoa application template, but I
know that it seems no need to use NSDocument class. Thanks.

You don't need to use the Document-based application template.

An application typically has a main nib. This is configured using the Main Nib File field of the Properties tab of the info window for the target. The value of that field gets translated at build time into the NSMainNibFile key in the application's Info.plist file.

The main nib is loaded by NSApplicationMain(). Often it contains the main window of your application, whatever that might be. However, the main nib can be reduced to contain only the main menu bar and nothing else. This allows you to defer the decision about what window to show until you receive the Apple Event you're expecting.

When you do receive it, you can load whatever nib you like. Often, you use a custom subclass of NSWindowController. Have it both load the nib and act as the nib's owner. In your nib, you'd configure the class of File's Owner to be your custom class. You'd connect its window outlet to the main window in that nib. In your application controller, at the time when you realize which nib you want to load, you allocate and initialize an instance of your class, and ask it to show its window. That last step will cause it to load its nib, thereby instantiating the window and showing it.

If for some reason you don't want to use NSWindowController to load the nib, you can use methods of NSBundle or NSNib to load the nib.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to