Re: modal over modal problem
Re: modal over modal problem
- Subject: Re: modal over modal problem
- From: Kyle Hammond <email@hidden>
- Date: Sat, 16 Apr 2005 10:58:43 -0500
Hi,
Remove that call to [NSApp stopModal] and only the dlgBrowse will go
away when it's done. There's no need to do a sheet or any other weird
contortions to get modal on modal windows working. You can have many
levels of modal windows all going if you really need to; it's not the
greatest design to force the user through many levels of modal windows,
but there's nothing in Cocoa preventing you from doing it.
It's not a Cocoa bug, it's a programming error.
Longer explanation: Your call "returnCode = [NSApp
runModalForWindow:dlgBrowse];" doesn't come back until the dlgBrowse
window is done. In other words, some other code (the controller for
dlgBrowse probably) has already stopped the modal loop for dlgBrowse.
Then your code continues on to remove the dlgBrowse from the screen
which is fine, although I generally put that code into the OK or Cancel
handler for the dlgBrowse itself. Then you call [ NSApp stopModal ]
which stops your ORIGINAL modal window that started the dlgBrowse.
Thus both modal windows disappear once the dlgBrowse is done.
Hope that helps.
Kyle
Op 11-apr-05 om 20:46 heeft Luc Vandal het volgende geschreven:
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:
I think this is a known bug (well, I submitted a bug report but no
action). I had to do some weird workaround where I used a sheet for the
second dialog. Unsavoury but it worked for me.
---------------------
Kyle Hammond
email@hidden
<http://www.snowmintcs.com/> - personal productivity software
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden