Document sheet not responding to keyboard events

孤街醉人 提交于 2019-12-04 17:52:06

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/7122696/document-sheet-not-responding-to-keyboard-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!