• 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
Sheet opens but not attached to window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sheet opens but not attached to window


  • Subject: Sheet opens but not attached to window
  • From: "Mike Chambers" <email@hidden>
  • Date: Mon, 8 Dec 2008 08:44:06 -0800

I am trying to create a custom sheet for my application.

The sheet is contained in a separate nib named "CalendarSheet", and
has a class called CalendarSheetController set as its File Owner. (The
class is below).

I open the sheet like so:

[calendarSheet showSheet:mainWindow];

Where mainWindow is defined as:

IBOutlet NSWindow *mainWindow;

(and is set up correctly).

This loads the nib, but displays it as a separate window, and not a
sheet. It doesnt have a title bar, but it is not attached to the
application window, and is not modal. In searching on google, I have
seen this reported a couple of times, but found no resolution.

I apologize if this is a super simple issue, but I am relatively new
to Cocoa, and am trying to get my head around the model.

Anyone see what I might be doing wrong? or any tips on what to check?

-------CalendarSheet.h---------
#import <Cocoa/Cocoa.h>


@interface CalendarSheetController : NSWindowController
{
       IBOutlet NSWindow *sheet;
}

- (void)showSheet: (NSWindow *)window;

@end
-------CalendarSheet.m---------
#import "CalendarSheetController.h"

@implementation CalendarSheetController


-(id)init
{
       if(![super init])
       {
               return nil;
       }

       return self;
}

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

- (void)showSheet: (NSWindow *)window
{
   if (sheet == nil)
       {
               [NSBundle loadNibNamed: @"CalendarSheet" owner: self];
       }

   [NSApp beginSheet: sheet
          modalForWindow: window
               modalDelegate: self
          didEndSelector: @selector(didEndSheet:returnCode:contextInfo:)
                 contextInfo: nil];
}

@end
-----------

mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Sheet opens but not attached to window
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: Shell tool with GUI
  • Next by Date: Re: Shell tool with GUI
  • Previous by thread: Re: Cocoa-dev Digest, Vol 5, Issue 2097
  • Next by thread: Re: Sheet opens but not attached to window
  • Index(es):
    • Date
    • Thread