Comrades:

I am working on a file-handling Cocoa app that (at this point) has a single window. We are adding a second window (really sort of a non- modal dialog) to do some extra processing of the target files. The interface for the new window is already built (with IB), but is not hooked up yet.

So, the way this started was as a AppController(ExtraCategory) thing, with the NIB file having a single controller object. I don't like that method, because there is a lot of data and code that would need to be replicated in the main AppController to handle the work that the ExtraCategory does. What I would like to do is put all the ExtraCategory stuff into its own class, but I am not sure how. My inclination is toward making the ExtraCategory into a NSWindowResponder, but the documentation I have read so far makes it look like that is more intended for document-based apps, which this is not. Also, I don't quite see (looking at some example code) how an extra controller is instantiated by the main app controller.

< A simplified example of the current code >

@interface AppController {
        NSString* srcDir;       // the original stuff
        NSString destDir;       // original
        // there is a bunch more

NSString* srcDirForExtraCategory; // needed for new window/dialog/ category
        NSString destDirForExtraCategory;       // needed for new
        // more stuff needed here
}
-(void)setSrc;  // implemented in the .m file, of course
-(void)setDest;
@end

<and in AppController(ExtraCtegory)>

@interface AppController(ExtraCategory)
-(void)setSrcForExtraCategory;  // special handling
-(void)setDestForExtraCategory; // special handling
@end

It seems funky to me that I can declare extra functions for the ExtraCategory, but I can't add member data. I understand there is a difference between the class/subclass and the class/category paradigms. I guess what I am trying to do is turn this new window category into a standalone class, instantiate it (in the NIB, I suppose), and control its availability from the original main app controller instance.

Any advice?
_______________________________________________

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