views:

83

answers:

2

Is it possible to have the values displayed in an NSComboBox be different from what is retrieved with objectValueOfSelectedItem?

So, it will display an object's string name but it's int recordId is returned instead of the string name? Other than using selected index and getting it from the source array, of course...

A: 

Are you looking for NSPopUpButton? It's more similar to an HTML <select>. An NSComboBox lets users directly type in new values, as well as pick them from a list, but you can't do that with plain HTML.

In any event, you should be able to give either control a bunch of custom objects that have a recordid property, and then retrieve the selection using [[comboBox objectValueOfSelectedItem] recordid]. You'll also need to write a custom formatter for these objects.

lemnar
A: 

AH! I feel so retarded. PopupButton is it.

objectValueOfSelectedItem wont work for me since it returns what is displayed and I want a string displayed but int returned.

thanks!

Joel Saltzman