PDA

View Full Version : NSComboBox programmatically pop-up method




jivaro
Apr 21, 2012, 12:02 PM
Is there any way of programmatically displaying a comboBox pop-up ?



Red Menace
Apr 21, 2012, 03:16 PM
Yes.

jivaro
Apr 21, 2012, 04:17 PM
Yes.

This is a GREAT new. Now, what is the way of doing it ??

Red Menace
Apr 21, 2012, 04:54 PM
Usually you would initialize the control, set some attributes, and add it to your window's content view, but without at least a little bit of help such as maybe OS and Xcode versions, language, exactly what you are wanting to do and what you have done so far, etc, you aren't going to get much help.

jivaro
Apr 22, 2012, 03:42 AM
Usually you would initialize the control, set some attributes, and add it to your window's content view, but without at least a little bit of help such as maybe OS and Xcode versions, language, exactly what you are wanting to do and what you have done so far, etc, you aren't going to get much help.

I'm trying to develop an application for Mac OS X. I'm running a G5 with Mac OS X version 10.5.8 and XCode 3.1.4. I bought this Mac 2nd hand for 200 €. After decades of PCs this is my first Mac, I am loving it and I plan to buy myself a new Mac for my next anniversary.

Now, going to my problem, I have implemented a piece of code allowing to (add and) remove items from a ComboBox:


NSString *comboEntry = [outletComboBoxCell stringValue]; // get comboBox entry
[outletComboBoxCell removeItemWithObjectValue:comboEntry]; // delete comboBox entry
[outletComboBoxCell setStringValue:@""]; // set comboBoxCell to nul

and I would like that after deleting an item from the ComboBox list, the pop-up list was displayed to show the rest of elements still there.

I have googled the issue, and found nothing so far, only a reference to a popUp method that is not documented and I have not been able to make it work.

I'm sure that there must be some solution to this issue, but I am not able to find it.

Sydde
Apr 22, 2012, 07:28 AM
Can you explain why a combo box is the best choice for what you are trying to accomplish? To me, it sounds like a rather awkward tool for the kind of thing you are describing (editing a list).

jivaro
Apr 22, 2012, 11:11 AM
Can you explain why a combo box is the best choice for what you are trying to accomplish? To me, it sounds like a rather awkward tool for the kind of thing you are describing (editing a list).

Its hard to realize a simpler option: 3 lines of code and it's done .....