On Apr 4, 2011, at 13:29, Torsten Geise wrote:

> So far, so good. My problem starts with passing objects to the dialog or 
> passing the content of the NSTextfield back to the caller. In the showDialog 
> function, I already have an instance to DialogController (instance 1). When 
> the NIB file gets loaded, it creates a second instance of DialogController 
> (instance 2) but containing the same instance of "window". 

OK, you have a few conceptual problems here. This DialogController is the cause 
of your problems.

-- The very brief sample code in the Sheet Programming Guide doesn't use an 
auxiliary controller. Presumably, the code it gives for using a custom sheet 
would go directly in the app delegate (or something like that). That's fine for 
a very simple sheet, but not much guidance when you want to use a separate 
controller object.

-- It's not clear, from your description of what you've done, what you expect 
the DialogController to *do* for you. Part of your trouble is you've decided 
you need one (or several), but you don't know what to use it for.

-- If you're going to use a controller, you may as well use a 
NSWindowController subclass, rather than rolling your own. A window controller 
works as well for sheets as it does for regular windows.

-- You shouldn't have 2 instances of the controller object. Presumably, you 
created one in your app delegate, and put a second one in the xib file, or 
created a second one manually. Don't do that!

If you take care of these problems, you should be a lot closer to your goal.


_______________________________________________

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

Reply via email to