Question

I have a NSStatusItem created like this:

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

I also have a popover with customview. On the view I have textfield: http://d.pr/i/CWbr

My popover is shown like this:

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

From a debuger I learned that sender here is an instance of NSStatusBarButton class.

The problem is that when the popover pops I can't type in textfield, it apears inactive: http://d.pr/i/q18U

The button is working though.

I think that problem is in the view I pass to ofView:. I tried to change it to a control on window like this:

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

And textfield became active (http://d.pr/i/DmTz) but I have no idea why this helps.

Why does my popover textfield becomes inactive when poped from menu? Why button works? How can I make textfield active?

P. S. My app is Application is agent (UIElement)

Was it helpful?

Solution

After writing the question I thought this can be related to key windows. So I searched for this connection and found this question: Not being able to edit NSTextField on NSPopover even though Editable behavior is set

This answered my question perfectly. It apears to be a bug.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top