Type Alias

NSModalResponse

A set of button return values for modal dialogs.

Declaration

typedef NSInteger NSModalResponse;

Discussion

The response value that a button returns can depend on which method is used to present the dialog. See alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:, runModal, and addButtonWithTitle: for examples.

Topics

Responses

NSModalResponseOK

The presentation or dismissal of the sheet has finished.

NSModalResponseCancel

The presentation or dismissal of the sheet has been canceled.

NSModalResponseContinue

Modal session is continuing (returned by runModalSession: only).

NSModalResponseStop

Modal session was broken with stopModal.

NSModalResponseAbort

Modal session was broken with abortModal.

NSAlertFirstButtonReturn

The user clicked the first (rightmost) button on the dialog or sheet.

NSAlertSecondButtonReturn

The user clicked the second button from the right edge of the dialog or sheet.

NSAlertThirdButtonReturn

The user clicked the third button from the right edge of the dialog or sheet.

Deprecated Responses

NSRunStoppedResponse

Modal session was broken with stopModal.

Deprecated
NSRunAbortedResponse

Modal session was broken with abortModal.

Deprecated
NSRunContinuesResponse

Modal session is continuing (returned by runModalSession: only).

Deprecated

See Also

Running a Modal Window

- runModalForWindow:

Starts a modal event loop for the specified window.

- stopModal

Stops a modal event loop.

- stopModalWithCode:

Stops a modal event loop, allowing you to return a custom result code.

- abortModal

Aborts the event loop started by runModalForWindow: or runModalSession:.

- beginModalSessionForWindow:

Sets up a modal session with the given window and returns a pointer to the NSModalSession structure representing the session.

- runModalSession:

Runs a given modal session, as defined in a previous invocation of beginModalSessionForWindow:.

modalWindow

The modal window displayed by the app.

NSModalSession

Variables of type NSModalSession point to information used by the system between NSApplication’s beginModalSessionForWindow: and endModalSession: messages.

NSModalPanelRunLoopMode

A run loop should be set to this mode when waiting for input from a modal panel, such as NSSavePanel or NSOpenPanel.