• 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: Using alerts with Preference Panes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using alerts with Preference Panes


  • Subject: Re: Using alerts with Preference Panes
  • From: Pete Gontier <email@hidden>
  • Date: Thu, 16 Dec 2004 18:54:19 -0800

circa 12/16/04 9:22 AM, "Pete Gontier" <email@hidden> wrote:

>>> I'm creating a preference pane, and I need an alert to show up if user
>>> information was incorrectly supplied. I tried using the NSBeginAlertSheet
>>> with my sample application and it worked fine, but when I moved the code
>>> over to my preference pane, the compiler did not seem to recognize my
>>> NSWindow (_window or a new outlet for window).
>>>
>> You can't attach the alert panel to your window, because System
>> Preferences.app takes the view from your window and attaches it to it's own.
>> Use [NSApp mainWindow]. This works.
>>
> Unfortunately, it did not make any difference for me. I too am attempting to
> post sheets onto the System Preferences window. I have a view in the window
> which I keep track of only so that I can call its window method to get a value
> I can pass to sheet-oriented methods. When I pass this value to the
> beginSheetForDirectory method of NSSavePanel or NSOpenPanel, everything works
> fine. However, when I pass this value to NSBeginAlertSheet, some truly weird
> stuff happens. I get a stand-alone alert instead of a sheet, and the System
> Preferences window disappears. I think the window is being hidden; selecting
> it from the Windows menu shows it again.

The problem was that I was trying to post a sheet against the main window
from within the didEndSelector of NSSavePanel. The solution for now appears
to be performSelector:withObject:afterDelay: to defer the posting of the
sheet for 0 seconds (the goal being to make the run loop iterate rather than
wait for some period of time). I am in denial that such a common task needs
to be done in such an obscure and indirect fashion, so if you have a better
idea, please let me know.

  --

    Pete Gontier
    http://www.m-audio.com/


 _______________________________________________
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

References: 
 >Re: Using alerts with Preference Panes (From: Pete Gontier <email@hidden>)

  • Prev by Date: Re: Controlling control sizes when programatically resizing a window
  • Next by Date: RE: has exited due to signal 10 (SIGBUS).
  • Previous by thread: Re: Using alerts with Preference Panes
  • Next by thread: Why are Monaco, Courier not showing up as fixed pitch?
  • Index(es):
    • Date
    • Thread