开发者

Get NSComboBox to work like an HTML Combo

开发者 https://www.devze.com 2022-12-13 22:26 出处:网络
Is it possible to have the values displayed in an NSComboBox be different from what is retrieved with objectValueOfSelectedItem?

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

精彩评论

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