> Quincey Morris wrote: >> You're kind of mixing up two different tasks here. The Camera object is >> (likely) part of your data model (in the MVC paradigm). A window controller >> is a ... controller. For your settings window, you'll have least heartache >> if you make the NIB's File's Owner a window controller. Window controllers >> are *designed* to be the owners of NIB files. >> >> So, subclass NSWindowController, and add a "camera" property. (Your Camera >> object can pass its 'self' pointer as a parameter to the window controller >> subclass's init... method.) >> >> Then, to get at Camera properties, objects in the NIB can bind to File's >> Owner.camera.whateverProperty -- instead of File's Owner.whateverProperty as >> you have now. > Ah, that is quite a neat solution - thanks for that. I hadn't twigged that I > could do that sort of "property of a property" binding. It still seems a bit > of a faff to create a controller subclass that isn't really doing anything > other than passing through property requests, but at least I don't have do > write accessors for every property I want to get at in the Camera object!
OK, while that's a very handy thing to know, I think I have worked out a simpler way that does not require an intermediate class - I'll state it here for the archives (and any comments welcome...) I show the window using the following code: @implementation Camera -(void)showSettingsWindow { if (settingsWindowController == NULL) [NSBundle loadNibNamed:@"Camera Settings" owner:self]; [settingsWindowController showWindow:self]; } @end ... and the NIB file (File's Owner = Camera) contains the window and a controller object (linked together), with the window controller linked to the outlet "settingsWindowController" in File's Owner placeholder. Jonny_______________________________________________ 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 arch...@mail-archive.com