Re: Custom sheets without going application modal?
Re: Custom sheets without going application modal?
- Subject: Re: Custom sheets without going application modal?
- From: Mike Ferris <email@hidden>
- Date: Tue, 31 Dec 2002 10:38:45 -0800
Sheets should not be application modal. The visual design and purpose
of a sheet is to be document-modal. If you need an application-modal
UI element, use a regular panel.
You might want to think about different ways to accomplish a thing if
you find that an application-modal sheet seems to be called for.
For example, Project Builder has a save confirmation sheet that can
handle multiple documents. If you try to quit from PB with one or more
unsaved files PB will throw an app-modal dialog that lists all the
unsaved files and gives you the opportunity to save all, some or none
of them or cancel the quit. I actually kind of wish something like
this panel was standard for NSDocument, but it is not hard to implement
in place of the (less optimal in my opinion) way that NSDocument
handles this case by default.
Mike
Begin forwarded message:
From: email@hidden (Simon Fraser)
Date: Mon Dec 30, 2002 3:14:35 PM US/Pacific
To: email@hidden
Subject: Re: Custom sheets without going application modal?
Mike Ferris wrote:
I do not think you want to call -runModalForWindow: at all. The
-beginSheet method should be used instead of -runModalForWindow:, not
in addition to. Also, you should call -endSheet: or
-endSheet:returnCode: when the sheet is finished (usually from the
action method of an OK/Cancel button... where you're calling
-stopModal now).
The old deprecated API -runModalForWindow: showed the window as a
sheet but put the app into the modal runloop mode and was therefore
kind of half way between a real app-modal panel and a real sheet.
The newer recommended -beginSheet:/-endSheet: API does not put the
app into modal run loop mode and therefore acts like a sheet should.
But what if you want an app-modal sheet, say if you're in
applicationShouldTerminate: and want to ask the user if it's
safe to quit, based on what's going on in one of the windows?
Simon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.