Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 689805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:22:13+00:00 2026-05-14T02:22:13+00:00

I am trying to display a custom sheet in my application, but I think

  • 0

I am trying to display a custom sheet in my application, but I think I am doing something wrong. While everything seems to be working just fine, I have a rather odd side-effect. (which took hours to figure out). It turns out that everytime I display a sheet in my application, the Application delegate gets set to the instance of the sheet, thus my Controller gets unset as the delegate causing all sorts of problems.

I’ve created a NIB file which I called FailureSheet.xib. I laid out my interface in IB, and then created a subclass of ‘NSWindowController’ called ‘FailureSheet.m’ which I set to the File’s Owner. Here is my FailureSheet class:

#import "FailureSheet.h"

@implementation FailureSheet  // extends NSWindowController

- (id)init
{
    if (self = [super initWithWindowNibName:@"FailureSheet" owner:self])
    {

    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (IBAction)closeSheetTryAgain:(id)sender
{   
    [NSApp endSheet:[self window] returnCode:1];
    [[self window] orderOut:nil];
}

- (IBAction)closeSheetCancel:(id)sender
{
    [NSApp endSheet:[self window] returnCode:0];
    [[self window] orderOut:nil];
}

- (IBAction)closeSheetCancelAll:(id)sender
{
    [NSApp endSheet:[self window] returnCode:-1];
    [[self window] orderOut:nil];
}

@end

Nothing complex going on here. Now this is how I display the FailureSheet in my ‘Controller’ class:

sheet = [[FailureSheet alloc] init];

[NSApp beginSheet:[sheet window]
   modalForWindow:window
    modalDelegate:self
   didEndSelector:@selector(failureSheetDidEnd:etc:etc:)
      contextInfo:nil];

Now if I log what the [NSApp delegate] is before displaying my sheet, it is <Controller-0x012345> which is correct. Then, after running this code and my sheet is up, if I log it again it is <FailureSheet-0xABCDEF>.

Not sure what I’m doing wrong here – Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:22:13+00:00Added an answer on May 14, 2026 at 2:22 am

    This is one of those “I’m-an-idiot” answers.

    Turns out I at some point I accidentally made a connection in my sheet’s NIB file between the Application and the File’s Owner (FailureSheet) setting it as the delegate. So, everytime it got loaded it overwrote the existing delegate connection I had in my MainMenu NIB file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just created an UITableView, trying to display some custom data from an array, but
I am trying to get my Blackberry application to display a custom modal dialog,
I have an MVC 3 application and am trying to display a custom validation
i am trying to display jquery calendar but somehow its just ignoring my request
I am trying to display a webview inside a custom dialog,its working outside the
I'm trying to display a custom progressdialog while loading RSS feed from an HTTP
I am trying to display a custom 422 page in my application. What is
I am trying to display the parsed xml data in custom listview but the
I am trying to display something off the side of a NSStatusItem. I think
I am trying to display a custom TableView on a UIViewController but am getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.