1

I want to call a sheet from within a view controller (user clicks on a button and the sheet will be displayed). Can the sheet have a separate window controller (with outlets and actions) or does the view controller from which the sheet is called operate as the sheet's controller?

I'm trying to determine how to display a sheet from a separate Interface Builder (.xib) file than my view controller. The sheet will have a list based on a popup menu item, so I would like to put that "logic" in a separate controller. I tried using a NSWindowController, but that didn't work.

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
  • What programming language? And please post some code/try to explain better what you're trying to do. – Jared Farrish Jun 05 '11 at 02:17
  • Sorry, using Cocoa OSX. I'm trying to determine how to display a sheet from a separate xib file than my view controller. The sheet will have a list based on a popup menu item, so would like to put that "logic" in a separate controller. Tried using a NSWindowController, but that didn't work. – Scott Henderson Jun 05 '11 at 03:14
  • What is with all the close votes lately? How is this “not a real question”? – Peter Hosey Jun 05 '11 at 03:23

1 Answers1

1

A stock NSViewController controls a view; nothing more. You can make a custom subclass that owns the sheet, or you can make it own a window controller which owns the sheet. The choice is yours.

Tried using a NSWindowController, but that didn't work.

You should ask another question about that.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
  • Peter, Thank you for the input. I made a subclass of NSPanel (owner of the sheet) which I call from my view controller. That seems to be working. I really appreciate the feedback. - Scott – Scott Henderson Jun 05 '11 at 05:50
  • 1
    @Scott: An NSPanel is a subclass of window. A sheet is one way to deploy a window (especially a panel). A window should not own another window. You should replace the NSPanel with an NSWindowController. – Peter Hosey Jun 05 '11 at 06:01