sheets in separate nibs

  • do I have to put sheets in separate nibs?

    all the examples in the documentation that I've found
    (NSPersistentDocument Core Data Tutorial and Custom Sheets) put a
    panel in a separate nib. This seems excessive.

    At the same time, I can't seem to use IBOutlet, because my objects
    are created at runtime due to user interaction. At least, even though
    the Outlet is connected, it claims that addPanel is nil.

    code snippet:

    @interface TreeWrapper : NSObject
    {
    IBOutlet NSPanel *addPanel;
    }

    - (void) showAddSheet
    {
    NSWindow *window = [NSApp mainWindow];
    //NSDocument *document = [[NSDocumentController
    sharedDocumentController] currentDocument];
    if (addPanel == nil) {
      NSLog(@"nil addpanel");
    }
    if (window == nil) {
      NSLog(@"nil window");
    }
    [NSApp beginSheet: addPanel modalForWindow: window modalDelegate:
    self didEndSelector: @selector
    (didEndAddSheet:returnCode:contextInfo:) contextInfo: nil];
    }

    This object is created during run time (ultimately from the user
    clicking a plus button), and running showAddSheet results in:

    2006-10-12 16:07:35.420 Conductor[27431] nil addpanel
    2006-10-12 16:07:35.466 Conductor[27431] *** Assertion failure in -
    [NSApplication
    _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndS
    elector:contextInfo:], AppKit.subproj/NSApplication.m:3057
    2006-10-12 16:07:35.466 Conductor[27431] *** NSRunLoop ignoring
    exception 'Modal session requires modal window' that raised during
    posting of delayed perform with target 3b4590 and selector
    'invokeWithTarget:'

    Is the only answer to use new nibs for each sheet? or is there
    another solution so I can keep all my sheets in the main nib?

    --Derrek
  • On Oct 12, 2006, at 6:37 PM, Derrek Leute wrote:

    > do I have to put sheets in separate nibs?

    No.

    Nick Zitzmann
    <http://www.chronosnet.com/>
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today