开发者

Get NSComboBox to work like an HTML Combo

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.开发者_开发问答..


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.


PopupButton is it.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜