• 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: dismissing sheets.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dismissing sheets.


  • Subject: Re: dismissing sheets.
  • From: j o a r <email@hidden>
  • Date: Fri, 7 Feb 2003 16:23:24 +0100

Please look in the list archives for similar discussions. The general message here is: "Don't mix code for running non-sheet-modal-panels with code for running sheets".

I have changed your code into something that might work:

====================================

/*
- (void) windowDidEndSheet:(NSNotification *)notification
{
[NSApp stopModal];
}
*/

- (void) sheetEnded: (NSWindow *)sheet returnCode: (int)returnCode context: (void *)contextInfo
{
[NSApp endSheet: sheet];
[sheet orderOut: self];
}

- (void) awakeFromNib
{
#if 1
// [self setDelegate: self]; // WTF???
#else
// [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowDidEndSheet:) name: NSWindowDidEndSheetNotification object: self];
#endif
}
- (BOOL) editPlayerOptions: (PlayerSelectionData *) player
{
id sheet;
if ([player isKindOfClass: [HumanPlayerSelectionData class]]) {
sheet = human_options;
} else if ([player isKindOfClass: [ComputerPlayerSelectionData class]]) {
sheet = computer_options;
} else {
return NO;
}

// [self setDelegate: self]; // WTF???

[NSApp beginSheet: sheet
modalForWindow: self
modalDelegate: self
didEndSelector: @selector(sheetEnded:returnCode:context:)
contextInfo: nil
];

// [NSApp runModalForWindow: sheet]; // No, no, no...

return YES;
}

====================================


j o a r
_______________________________________________
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: dismissing sheets.
      • From: j o a r <email@hidden>
References: 
 >dismissing sheets. (From: Tobias Sargeant <email@hidden>)

  • Prev by Date: setting the insertion point in NSTextView
  • Next by Date: Re: bad memory access problem
  • Previous by thread: dismissing sheets.
  • Next by thread: Re: dismissing sheets.
  • Index(es):
    • Date
    • Thread