的NSTextField不活跃NSPopover连接到NSStatusItem

问题描述:

我有一个NSStatusItem这样创建:的NSTextField不活跃NSPopover连接到NSStatusItem

statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; 
[statusItem setTitle:@"DS"]; 
[statusItem setHighlightMode:YES]; 
[statusItem setAction:@selector(StatusClicked:)]; 
[statusItem setTarget:self]; 

我也有一个customview酥料饼。在视图我有文本框:http://d.pr/i/CWbr

我酥料饼是这个样子:

- (void)StatusClicked:(id)sender { 
    [self.popover showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMaxYEdge]; 
} 

从debuger我了解到,sender这里是NSStatusBarButton类的一个实例。

的问题是,当酥料饼的爆裂声,我不能键入文本框,它apears不活动:http://d.pr/i/q18U

按钮是否工作虽然。

我认为这个问题是在我传递给ofView:的视图中。我试图将其更改为一个控制窗口上是这样的:

[self.popover showRelativeToRect:[sender bounds] ofView:self.postText preferredEdge:NSMaxYEdge]; 

和TextField开始活跃(http://d.pr/i/DmTz),但我不知道为什么这会有所帮助。

为什么我的popover文本字段在从菜单中移动时变为非活动状态? 为什么按钮有效? 如何让文本框处于活动状态?

P. S. 我的应用程序是Application is agent (UIElement)

写我想这可能与关键窗口的问题后。所以我搜索了这个连接,发现这个问题:Not being able to edit NSTextField on NSPopover even though Editable behavior is set

这完美地回答了我的问题。它似乎是一个错误。