Question

I have a NSComboBoxCell that allows users to select an item from a list, but currently it also allows the user to type a value that they would like. I haven't been able to figure out a way to make it so that the user cannot type into the combo box (I just want them to be able to pick what is on the list). This seems like it should be relatively simple (even an interface builder option) but if so, I'm completely over looking it. Any ideas?

Note: This is for OSX and not iOS.

Was it helpful?

Solution

You should use an NSPopUpButton instead of an NSComboBox. The whole point of NSComboBox is that it provides both a text field that the user can type into and a popup button so they they can quickly choose options from a menu, generally as shortcuts for common values. NSPopUpButton just displays a menu. NSPopUpButtons are available in Interface Builder.

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