I'm pretty new to Cocoa, and I have an NSComboBox which I'm populating with an NSComboBoxDataSource. So far so good, but the one thing I haven't been able to figure out is what type of objects can be stored. I've had success with strings, but I'd like to be able to store more info than what is displayed. I've tried storing a custom object which represents what is being listed (clients), but of course nothing is displayed.
Asked
Active
Viewed 223 times
1 Answers
1
You can save any object
, in your model.
But for display purpose string will be good. And based on the selection of the string value, you can fetch the entire object ( it may be in arrays or dictionaries). Then anywhere in your gui you can display all the propeties.
As, when you nslog dictionary or array having objects, you see only its memory locations not the values inside the object. You have to again break them to display. So is the case here.

Anoop Vaidya
- 46,283
- 15
- 111
- 140
-
Thanks, I was approaching this wrong. The data source handles object storage, and only passes the display strings to the combo, right? – Benjineer Jan 03 '13 at 03:02
-
it doesnot pass, you have to pass..whatever value you need to show. – Anoop Vaidya Jan 03 '13 at 04:14