Modal Windows and Panels

Display a modal window or show one of the standard app panels, such as the app's About panel.


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:.


The modal window displayed by the app.


A set of button return values for modal dialogs.


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


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

Managing Panels

- orderFrontColorPanel:

Brings up the color panel, an instance of NSColorPanel.

- orderFrontStandardAboutPanel:

Displays a standard About window.

- orderFrontStandardAboutPanelWithOptions:

Displays a standard About window with information from a given options dictionary.

- orderFrontCharacterPalette:

Opens the character palette.

- runPageLayout:

Displays the receiver’s page layout panel, an instance of NSPageLayout.


Keys to include in the options dictionary when displaying an About panel.


- endModalSession:

Finishes a modal session.

- endSheet:

Ends a document modal session by specifying the sheet window.

- endSheet:returnCode:

Ends a document modal session by specifying the sheet window.


See Also

Managing Windows, Panels, and Menus

App Windows

Show, hide, minimize, arrange, and update your app's windows.