• 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
Modal sheet for a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modal sheet for a window


  • Subject: Modal sheet for a window
  • From: Mike Kobb <email@hidden>
  • Date: Fri, 9 Jun 2006 14:34:49 -0700

Howdy,

As mentioned in my previous message, I'm an experienced engineer, but I'm implementing my first Cocoa app (and first MacOS X app!) in the form of a System Preferences pane to control a server process.

There are a couple of places in the control flow of the app where I need to stop everything and ask the user to make a choice.

This is an app-modal type of thing (since the preference app has only one window), and I've been able to use an NSRunAlertPanel to do this inline with my code.

However, it seems like the HI guidelines and general aesthetics of MacOS programming these days suggests that I should really be using a sheet in this context.

In fact, if you want to see a perfect example of how it should look go to the Network prefs pane, select your current interface, select the TCP/IP tab, make a change (maybe switch the menu to Manual from DHCP), and then try to quit the System Preferences app. An alert sheet will pop down from the preferences window asking if you want to apply your changes, and offering three choices.

I've read and re-read the documentation, and I think I must be missing something, because I can't figure out how to do this type of synchronous alert as a sheet, analogous to NSRunAlertPanel. It seems overly clunky to have to implement delegate methods to handle a case like this where the place you need the result is really right there where you're posting the alert.

  Basically, I'd like to end up with something like this pseudocode:

- (void)handleQuit
{
    if( choicesNeedSaving )
    {
        userReply = doModalAlertSheet(various messages and options);
        if( userReply == OK )
            saveChoices;
        else
            cancelChoices;
    }
}

To make things maximally annoying, we need the solution to work on 10.2.x or later, ideally.

Thanks for any help!
--Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Modal sheet for a window
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Validation of NSTextField contents
  • Next by Date: Re: Update NSTextField programatically while cursor is in it
  • Previous by thread: Validation of NSTextField contents
  • Next by thread: Re: Modal sheet for a window
  • Index(es):
    • Date
    • Thread