I've been around this for a while.. I thought this should be an easy task, but it isn't =D
What I am trying to do, is to display the combobox's list when the user clicks the combobox but not specifically in the button.
Any Idea? Thanks in advance!
I've been around this for a while.. I thought this should be an easy task, but it isn't =D
What I am trying to do, is to display the combobox's list when the user clicks the combobox but not specifically in the button.
Any Idea? Thanks in advance!
Thanks to jmoody and Jens Alfke mentioned above. Here is a SWIFT translation of the above solution.
class CComboBoxEx: NSComboBox
{This answer fits the title of the question, but not question itself. Omer wanted to touch a text field and have the box popup.
This solution shows the popup when the user enters text.
I found this answer on cocoabuilder from Jens Alfke. I reposted his code here. Thanks Jens.
original cocoabuilder post: (http://www.cocoabuilder.com/archive/cocoa)
I used this code in my
controlTextDidChange:
method.Returns
true
if the NSComboBox's list is expandedOpen the NSComboBox's list
Close the NSComboBox's list
Ref. jmoody’s answer.
NSComboBox was not designed to work this way. Because the user may want to edit the text in the control, they'll need to be able to click it without unexpectedly popping up the choices.
You would need to subclass NSComboBoxCell and change this behavior ... but then you'd have a standard-looking control that does not behave in a standard way. If you're determined to do this, take a look at the open source version of NSComboBoxCell. The interesting methods appear to be -popUpForComboBoxCell: and friends.
You can use the following code line:
Put
Into
is what I ended up with. Thanks @Ahmed Lotfy
Here's the full code, it works for me on OSX 10.11