Beginner question with sheets
Beginner question with sheets
- Subject: Beginner question with sheets
- From: Steve Roy <email@hidden>
- Date: Tue, 18 Mar 2003 09:05:44 -0500
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.