Re: Displaying an alert box
Re: Displaying an alert box
- Subject: Re: Displaying an alert box
- From: Stéphane Sudre <email@hidden>
- Date: Mon, 15 Oct 2001 19:11:40 +0200
On lundi, octobre 15, 2001, at 06:48 , Douglas Davidson wrote:
Let me expand a little on the distinction between NSAlert and
CFUserNotification.
NSAlert is the standard means for a Cocoa application to put up an
alert dialogue. It is the appropriate way for an application to alert
the user about goings on in that application ("This document is 500
pages long. Are you sure you wish to discard it?"). When an
application other than the currently active one puts up an NSAlert,
Cocoa generally makes efforts to notify the user by some means that
the application needs attention, though the actual means used may
potentially depend on the OS version or on user preferences (for
example, once we have holographic displays, the application's icon
might jump out of the screen and do a backflip). You should be able to
find information on NSAlert among the Cocoa reference documentation.
is there a way to launch a Cocoa application that will not become the
frontmost application ? So that the Alert would be behind the former
frontmost application.
The primary design purpose of the User Notification Center, AKA
CFUserNotification, is to provide means for background processes,
system daemons, the kernel, and other tasks that otherwise do not have
a GUI interface, to have some limited form of interaction with the
user--for example, to request a necessary password, or to notify the
user of some significant happening ("Your computer has caught on fire.
Please extinguish it."). It has low-level interfaces
(CFUserNotification is the CF-level one) so that it can be used almost
anywhere in the system. The promise it makes is that it will attempt
to present the notification requested to a user at the console in some
form, if possible, but it does not guarantee what form this will take.
By console, you mean the Login: > console mode ?
BTW, on the form issue, the yellow ones of Mac OS 9 had one pro missing
in OS X: you didn't have to close them.
It can also be used by applications that have GUI interfaces of their
own, but this should be done sparingly, because the form it takes is
often quite intrusive (currently it will usually put up dialogues that
float above almost everything else, although they are non-modal and can
be moved out of the way).
So it's an appropriate solution. (Ok, it's an ugly hack).
The only documentation I know of at the moment for CFUserNotification
is in the header file, but I can provide some sample code for those who
need help.
Yes the header file is a little void when it comes to customized GUI.