Sheets
Sheets implement window modal (as opposed to application modal) dialogs that are attached to the window. Thus, when a dialog pops up asking for attention, it blocks interaction only with that particular window, not the entire application. When a sheet is opened or closed, it appears to slide out of the title bar. Because the sheet is attached to another window, such as a document window, the user never loses track of what dialog belongs with which window. Figure 3-8 shows an example of a sheet.
The Application Kit defines a number of convenient functions for
displaying standard alert and message sheets, including
NSBeginAlertSheet
,
NSBegin-InformationalAlertSheet
, and
NSBeginCriticalAlertSheet
. Each function takes the
same parameters; they differ only in the icon displayed on the left
of the sheet. The function prototype for
NSBeginAlertSheet
is the following:
void NSBeginAlertSheet(NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ...)
Table 3-2 describes each parameter.
Parameter |
Description |
Title |
The title of the sheet, displayed at the top of the sheet in bold-faced font. |
defaultButton |
The title of the ... |
Get Cocoa in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.