Search code examples
objective-ccocoanswindownsapplication

Document sheet not responding to keyboard events


I think it's a first responder problem, but I'm not sure. I'm implementing an edit window for data in a table view. Very similar in concept to the UI for editing filter rules in Mail.app.

I have an editing window that I attach to my primary window with:

[NSApp beginSheet: criteriaEditPanel 
   modalForWindow: [self window] 
    modalDelegate: self 
   didEndSelector: @selector(criteriaEditDidEnd:returnCode:contextInfo:) 
      contextInfo: (void *)[criteriaList objectAtIndex: index]];

The panel displays properly, from the title bar of the main window. I can manipulate the pop-up controls on the panel with the mouse, but I can't edit the text fields and I can't tab between fields. Everything else works fine. Any ideas?

joe


Solution

  • Solved. Believe it or not, you have to have the Title Bar enabled for the panel, even though it's never visible when displayed as a Sheet. When enabled it in IB, keyboard input started working.

    @spudwaffle - none of the objects had Refuse First Responder checked.