I'm trying to add images into a combobox instead of text. Someone recommended I use the TComboBoxEx
instead of TComboBox
, but how does it work?
I found a tutorial, but it's confusing and I do not understand. Does it work different than normal ComboBox? https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/TComboBoxEx_(Delphi)
With TComboBox
, there's a TStrings
Items
property that I can use to change the text.
I do not see a Items
property for TComboBoxEx
.
How can I have images for a dropdown instead of Text?
You can use the
ItemsEx
property to add text and images. Double clicking onItemsEx
opens this window:From there with the top-left button, you can add dropdown items and then you'll see a
Caption
andImageIndex
for each item:The images are populated through a
TImageList
component that you have to drop onto the form as well and then there's anImages
property on theTComboBoxEx
that you have to set equal to theTImageList
And that's it. Then you have your ComboBox with images: