Is there a ComboBox that has Items like a TcxRadioGroup?

末鹿安然 提交于 2019-12-10 11:54:45

问题


The TcxRadioGroup component of DevExpress has a very nice way to specify items. You can specify a Caption and a Value (and a Tag) for each TcxRadioGroupItem.

The TcxComboBox and the normal TComboBox of Delphi on the other hand use TStrings to store its items.

While TStrings can have a Name and an Object, there is no easy way to hook up a name and a value using the form designer of the Delphi IDE.

Is there a ComboBox control (preferably from DevExpress) that allows to visually design its items with a Caption and a Value?

PS: I'm not looking for a DB aware control.


回答1:


Try a TcxImageComboBox. See here - you don't have to assign images despite the name. You can also edit the items visually.

(I use it as cell editor in cxGrids because of the separation Description/Value.)




回答2:


Raize Components have TRzComboBox which introduces a Values property as an addition to the existing Items.




回答3:


ESBPCS for VCL has an enhanced Lookup ComboBox. It stores 2 Lists, the ones normally in TCombobox's Items as well as the new Values list. These two StringLists are in a 1-1 relationship. Use AsItem to retrieve the string currently displayed and AsValue to retrieve the "related" string from Values.




回答4:


Use a standard Delphi TComboBox, it can store a string (for visualization, and an object of any TObject descendant that you implement yourself, i.e you can store anything associated to a string in the dropdown).



来源:https://stackoverflow.com/questions/8184128/is-there-a-combobox-that-has-items-like-a-tcxradiogroup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!