• 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: Passing an object to a custom sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing an object to a custom sheet


  • Subject: Re: Passing an object to a custom sheet
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 05 Apr 2011 00:24:24 -0700

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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Passing an object to a custom sheet (From: Torsten Geise <email@hidden>)

  • Prev by Date: Passing an object to a custom sheet
  • Next by Date: Re: Passing an object to a custom sheet
  • Previous by thread: Passing an object to a custom sheet
  • Next by thread: Re: Passing an object to a custom sheet
  • Index(es):
    • Date
    • Thread