NSPextField在NSPopOver中不活动 [英] NSTextField not active in NSPopOver

查看:135
本文介绍了NSPextField在NSPopOver中不活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个菜单应用程序,它打开一个popover。该弹出框包含NSTextField和几个按钮。问题是NSTextField是不可选择的,它不可能在其中键入任何内容。然而,它可以点击它用鼠标右键,并粘贴一些东西。嗯,这绝对是奇怪的行为。

I have a menubar application, which open a popover. That popover contains NSTextField and few buttons. The problem is that the NSTextField is non-selectable, it's impossible to type anything in it. However, it's possible to click on it with mouse right button and paste something. Well, that's definitely odd behavior. Buttons works without any problems in that popover, btw.

这里是我使用的代码:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    [NSApp activateIgnoringOtherApps:YES];
    statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];
    [statusItem setAction:@selector(showPopOver:)];
    [statusItem setImage:[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"]]];
    [statusItem setHighlightMode:YES];
}

和:

- (IBAction)showPopOver:(id)sender {
     popover = [[NSPopover alloc] init];
     [popover setContentViewController:popOverController];

     popover.animates = YES;
     popover.delegate = self;

     [popover showRelativeToRect:[sender bounds] 
                          ofView:sender 
                   preferredEdge:NSMaxYEdge];

    }
}

如何解决?

推荐答案

似乎是一个错误。
http://openradar.appspot.com/9722231

这篇关于NSPextField在NSPopOver中不活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆