Reputation: 1398
I've got a search-suggestion box that I've implemented by using an NSScrollView that appears when you start typing in an NSTextField. I'd like my window to be quite short, and have the ScrollView draw partially outside the window. Like this:
But instead I get this:
What can I do?
Upvotes: 0
Views: 150
Reputation: 90681
You can't have controls that extend outside of a window. What you need to do is put them in a separate window. You generally want that window to be a child of the original window (using -[NSWindow addChildWindow:ordered:]
).
For the use case you describe, you should use the built-in control, NSComboBox
. If you really want to reimplement this sort of control, Apple provides the CustomMenus sample code and a related WWDC video. It specifically includes a suggestions menu to help fill in a text field.
Upvotes: 2