Programming => LCL => Topic started by: RainerHamann on October 21, 2021, 06:11:06 pm
Title: select item in TComboBoxEx
Post by: RainerHamann on October 21, 2021, 06:11:06 pm
I want to set and select items of TComboBoxEx dependend from other user action like TComboBox.ItemIndex:=... and ShowMessage(TComboBox.Text), but there is nothing like e.g. ItemIndexEx or TextEx to set or read both properties.
I'm using Lazarus 2.2.0RC1 with QT5 property set for my project on Linux Mint.
Title: Re: select item in TComboBoxEx
Post by: RainerHamann on October 21, 2021, 10:35:24 pm
No, I want to show one line (icon and text) in the extended ComboBox. With a standard ComboBox I would do
ComboBoxEx1.ItemIndex:=1;// Select the 2nd item (having index 1)
Retrieving the item caption is a bit more complicated since the property ItemsEx[index] returns the full item instance at the given index. But there's a property Caption for the text of of that item:
Other properties of the ItemsEx[index] are: - ImageIndex - OverlayImageIndex - SelectedImageIndex - Indent (Just what is available when you populate the items by the '...' button next to ItemsEx in the object inspector).
Unlike a TCombobox which is populated by calling ComboBox1.Add(text_of_the_item) you populate the TComboBoxEx at runtime this way: