Skip navigation.
 
mlRe: Custom sheets without going application modal?
FROM : Mike Ferris
DATE : Mon Dec 30 21:29:12 2002

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.

Mike


Begin forwarded message:

> From: Sherm Pendley <<email_removed>>
> Date: Sun Dec 29, 2002  6:23:14 PM US/Pacific
> To: Joshua Scott Emmons <<email_removed>>
> Cc: <<email_removed>>
> Subject: Re: Custom sheets without going application modal?
>
> On Sunday, December 29, 2002, at 04:33 PM, Joshua Scott Emmons wrote:
>

>> My application pulls up a custom sheet to enter some new-record info.
>>  Every example I've ever seen to get a custom sheet working uses
>> something like the following:

>
> ... snip ...
>

>> Correct me if I'm wrong, but this takes the *whole application*
>> modal, right?

>
> Yep, you're right. Don't quote me on it, but I *think* that the
> erroneous examples can be traced back to some Apple docs that were, at
> one point, a bit vague on the subject. The current docs are clearer.
>

>> What is the danger in me implementing the above like so:
>
> No danger at all - in fact, it's the preferred way to open a
> window-modal (as opposed to app-modal) sheet.
>

>>    [mySheet orderOut:self];
>
> One minor nit - orderOut: makes the sheet invisible, but doesn't
> release it. That's good for a sheet that could be used relatively
> frequently, as it pops up quicker on subsequent uses. But, for an
> infrequently-used sheet, you could save a bit of memory by sending it
> a close message instead, which releases it.
>
> sherm--
>
> UNIX: Where /sbin/init is Job 1.
> _______________________________________________
> cocoa-dev mailing list | <email_removed>
> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlCustom sheets without going application modal? Joshua Scott Emmon… Dec 29, 22:33
mlRe: Custom sheets without going application modal? Gregory Weston Dec 30, 02:04
mlRe: Custom sheets without going application modal? Sherm Pendley Dec 30, 03:23
mlRe: Custom sheets without going application modal? Mike Ferris Dec 30, 21:29
mlRe: Custom sheets without going application modal? sfraser Dec 31, 00:14
mlRe: Custom sheets without going application modal? Mike Ferris Dec 31, 19:38