Reputation: 123
I can't figure out why the sheet is not modal and the focus is still on the main window.
- (IBAction) showSheet:(NSWindow*)window
{ // User has asked to see the dialog. Display it.
if (!_clientsDialog)
[NSBundle loadNibNamed: @"clientsDialog" owner: self];
[NSApp beginSheet:self.clientsDialog
modalForWindow: [[NSApp delegate]window]
modalDelegate: self
didEndSelector: NULL
contextInfo: NULL];
}
Upvotes: 2
Views: 764
Reputation: 1316
The following method works for me:
Header File:
- (IBAction)showSheet:(id)sender;
Method file:
- (void)showSheet:(id)sender {
if (! _clientsDialog)
[NSBundle loadNibNamed: @"clientsDialog" owner: self];
[NSApp beginSheet: _clientsDialog
modalForWindow: [[NSApp delegate] window]
modalDelegate: self
didEndSelector: NULL
contextInfo: NULL];
}
IMPORTANT: You need to have a Title Bar on your window. Otherwise Controls won't work.
Upvotes: 4