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

Re: Sheet opens but not attached to window


  • Subject: Re: Sheet opens but not attached to window
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 8 Dec 2008 17:24:32 +0000

In IB, your window is probably set to be visible at launch. Turn that off as you are managing the visibility yourself.

Mike.

On 8 Dec 2008, at 16:44, Mike Chambers wrote:

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

_______________________________________________

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


References: 
 >Sheet opens but not attached to window (From: "Mike Chambers" <email@hidden>)

  • Prev by Date: Not getting KeyDown events (and other peculiar things)
  • Next by Date: Re: NSDictionary mutability test
  • Previous by thread: Sheet opens but not attached to window
  • Next by thread: NSArray represented in 2 different views at same time
  • Index(es):
    • Date
    • Thread