-->

里面NSPopover的NSTextField不是键,直到鼠标点击(NSTextField insi

2019-09-17 10:02发布

我有一个从与NSStatusItem互动所示的NSPopover。 我的博客上讲述我需要做的,使输入甚至有可能在这种情况下,这里的黑客: http://blog.brokenrobotllc.com/using-nspopover-with-nsstatusitem

我有NSPopover的内容视图内的的NSTextField。 当我打开NSPopover的的NSTextField看起来好像是关键(光标闪烁)。 但是,打字的时候,什么也不显示。 如果我点击鼠标在外地,我的输入开始显示在那里。

我已经试过类似的事情在popoverDidShow调用NSWindow的makeFirstResponder :. 有从这种行为没有任何变化。 任何人有任何想法吗?

Answer 1:

我的猜测是,你需要让你的应用活跃; 尝试调用

[NSApp activateIgnoringOtherApps:YES];

当你告诉你的酥料饼。

编辑:当然,我可能是错的。 这一切都只是把我的头顶。



文章来源: NSTextField inside NSPopover is not key until mouse click