Thanks for your answer, I'll do just that.

On Sep 1, 2009, at 9:59 PM, Graham Cox wrote:


On 02/09/2009, at 12:50 PM, Chase Meadors wrote:

the class keeps the "readyNewItem" property updated according to what happens with the sheet. The problem is, the -runNewItemSheet method is returning right after starting the sheet. What I want is for it to wait until the didEnd selector is called to return from the -runNewItemSheet method. That way, "readyNewItem" will be properly assigned and not nil.

Is there any way I can accomplish this while still allowing the panel to work (IBActions etc.) but not return from the original calling method? I'm drawing a blank here.

Thanks for any help.


You can't.

You need to refactor your code so that the code that needs to run when the sheet is dismissed is triggered by the sheetDidEnd:... method. You can't wait on a sheet completing then continue - the design is simply not modelled around that approach. The only time that will work is if you are running an application modal dialog, but a sheet is not application modal.

I usually handle this by declaring an informal delegate protocol for the controller class that handles the sheet, and setting the delegate when I ask the controller to run the sheet. The controller implements the sheetDidEnd: method, and if OK (or whatever) was clicked it invokes the method on the delegate that I decided it would invoke. Then the delegate (the original caller) performs the relevant task.

--Graham



_______________________________________________

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