• 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: Custom sheets without going application modal?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom sheets without going application modal?


  • Subject: Re: Custom sheets without going application modal?
  • From: Mike Ferris <email@hidden>
  • Date: Mon, 30 Dec 2002 12:29:12 -0800

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@hidden>
Date: Sun Dec 29, 2002 6:23:14 PM US/Pacific
To: Joshua Scott Emmons <email@hidden>
Cc: <email@hidden>
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@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.

  • Follow-Ups:
    • Re: Custom sheets without going application modal?
      • From: email@hidden (Simon Fraser)
References: 
 >Re: Custom sheets without going application modal? (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: NSTableView bug: No scroll bar
  • Next by Date: Re: Dynamically resizing NSView
  • Previous by thread: Re: Custom sheets without going application modal?
  • Next by thread: Re: Custom sheets without going application modal?
  • Index(es):
    • Date
    • Thread