Adding an NSTextField as a subview

Posted by Kenny on Stack Overflow See other posts from Stack Overflow or by Kenny
Published on 2010-05-29T00:37:45Z Indexed on 2010/05/29 0:42 UTC
Read the original article Hit count: 310

Filed under:
|

I'm trying to add an NSTextField as a subview of a custom view class I have (which subclasses NSView), and then make the text field the first responder. This works fine... the text field shows up and I can start typing in it. However, any mouse events in the text field seem to fall through to its superview. For example, I can't see the mouse cursor when I hover over the text field, and when I click anywhere in the text field, it attempts to resign firstResponder status instead of letting me select text within the text field.

I'm not overridding hitTest or anything weird like that, and I only have one window, which is definitely the key window. Any ideas?

Thanks in advance! :-)

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa