View Full Version : Modal Window

Apr 29, 2011, 12:49 AM
I am just trying to make my Window as a modal window (that is parent window should not be accessed once this window is launched)

Is this code would do? Anything wrong in this

m_myWindowController = [[MyWindowController alloc] initWithWindowNibName:@"Settings"];
[m_myWindowController close];
[[m_myWindowController window] setParentWindow:self.window];
[NSApp runModalForWindow:[m_myWindowController window]];

Apr 29, 2011, 03:42 AM
Have a look at the Using Application-Modal Dialogs (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Sheets/Tasks/UsingAppModalDialogs.html) chapter of the Sheet Programming Topics guide. Also look at the Using Modal Windows (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/WinPanel/Concepts/UsingModalWindows.html) chapter of the Window Programming Guide.

But also see your other thread.