NSTextField not active in NSPopOver

╄→гoц情女王★ 提交于 2019-12-12 14:33:09

问题


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.

Here's the code i use:

- (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];
}

and:

- (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];

    }
}

Any ideas what the problem exactly and how to fix it?


回答1:


Seems is a bug. http://openradar.appspot.com/9722231



来源:https://stackoverflow.com/questions/7010180/nstextfield-not-active-in-nspopover

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