Re: Beginner question with sheets
Re: Beginner question with sheets
- Subject: Re: Beginner question with sheets
- From: Marco Binder <email@hidden>
- Date: Tue, 18 Mar 2003 16:34:53 +0100
Hi,
I m sorry if this is insulting, but have you ever checked, if
(returnCode == NSAlertPanel.DefaultReturn) ?? This would be me first
guess. Just put an println statement after the if and check...
Marco
Am Dienstag, 18.03.03 um 15:05 Uhr schrieb Steve Roy:
Hi again,
I'm only beginning to learn Cocoa via Java. I'm trying to close a
window after a
sheet has asked the user to confirm the operation. The sheet is
displayed, and
my selector is called properly afterward, but somehow my
window.performClose()
call doesn't do anything. Nothing happens, the window just stays there.
public class CloseController
{
public NSWindow window;
public void closeWindow(Object sender)
{
NSAlertPanel.beginAlertSheet(
"Close Window", "Close", null, "Cancel", window, this,
new NSSelector("closeOrNot", new Class[]
{NSWindow.class, Integer.class, Object.class}),
null, sender, "Do you really want to close the window?");
}
public void closeOrNot(NSWindow sheet, int returnCode, Object
contextInfo)
{
System.out.println("returnCode=" + returnCode);
System.out.println("contextInfo=" + contextInfo);
if (returnCode == NSAlertPanel.DefaultReturn)
window.performClose(contextInfo);
}
}
If I put window.performClose(sender) in the closeWindow() method then
it works
fine. But moving it to closeOrNot() doesn't. I don't see any errors in
the
console, and I know the returnCode and contextInfo are what I expect.
I'm
thinking maybe I need to put a delay to allow time for the sheet to
roll back
up, but that can't be right. So what am I doing wrong?
Steve
--
Steve Roy <email@hidden>
http://homepage.mac.com/sroy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
--
|\ /| E-Mail: email@hidden WWW: www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.