• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Beginner question with sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Beginner question with sheets
      • From: Steve Roy <email@hidden>
  • Prev by Date: Re: NSAutoreleasePool: how does it really work?
  • Next by Date: RE: New Obj-C root class and forwarding
  • Previous by thread: Beginner question with sheets
  • Next by thread: Re: Beginner question with sheets
  • Index(es):
    • Date
    • Thread