0

This question is answered Not being able to edit NSTextField on NSPopover even though Editable behavior is set, but because StackOverflow doesn't allow you to comment unless you have a certain reputation I'm having to create another thread. I did exactly as explained in the answer with no luck. This is on 10.9 with Xcode 5. I added the NSWindow+CanBecomeKeyWindow.m to the build settings. Because this is a status bar only app I have Application is Agent set to YES in the plist and am not using any windows in the application. Any ideas how to implement this with Mavericks?

NSWindow+canBecomeKeyWindow.h
@interface NSWindow (canBecomeKeyWindow)

@end

NSWindow+canBecomeKeyWindow.m
@implementation NSWindow (canBecomeKeyWindow)

//This is to fix a bug with 10.7 where an NSPopover with a text field cannot be edited if its parent window won't become key
//The pragma statements disable the corresponding warning for overriding an already-implemented method
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
- (BOOL)canBecomeKeyWindow
{
    return YES;
}
#pragma clang diagnostic pop

@end
Community
  • 1
  • 1
Stephen Donnell
  • 810
  • 9
  • 20
  • Please edit your answer to include your actual implementation. Even if your implementation is the same as the link question, your situation is obviously different, so providing the relevant code would be useful (and will help in google searches for future instances of this problem). – nhgrif Jan 13 '14 at 01:32

1 Answers1

0

Got it working. You have to completely clear out the interface and implementation code so that you are just overriding the NSWindow canBecomeKeyWindow method. Do exactly as listed above and make sure the .m file is listed in your build phases.

Stephen Donnell
  • 810
  • 9
  • 20