-->

Is there a ComboBox that has Items like a TcxRadio

2019-06-14 01:59发布

问题:

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).