Skip navigation.
 
mlmodal over modal problem
FROM : Luc Vandal
DATE : Mon Apr 11 20:46:23 2005

Hi,

I have a modal window that displays another modal window:

int    returnCode;
returnCode = [NSApp runModalForWindow:dlgBrowse];
[dlgBrowse orderOut:self];
[NSApp stopModal];

The problem is that when I click on Ok or Cancel on the 2nd window
(which was opened by the 1st modal window), stopModalWithCode will
close both windows at the same time. So I tried this:

- (void)displayBrowseDlg
{
   m_dlgBrowseSession = [NSApp beginModalSessionForWindow:dlgBrowse];
   [NSApp runModalSession:m_dlgBrowseSession];
}

- (IBAction)onDlgBrowseCancel:(id)sender
{
   [NSApp endModalSession:m_dlgBrowseSession];
   [dlgBrowse orderOut:self];
}

Now the problem is that if I click on Ok or Cancel, I get this beep
sound and cannot seem to be able to click on the buttons. If I hit
enter or escape the window does dissapear.

Is there a proper way to handle many modal dialogs?

Thanks!

Luc

Related mailsAuthorDate
mlmodal over modal problem Luc Vandal Apr 11, 20:46
mlRe: modal over modal problem Steven Kramer Apr 16, 14:49
mlRe: modal over modal problem Kyle Hammond Apr 16, 17:58
mlCocoa and modality (was: modal over modal) Steven Kramer Apr 17, 13:33