Bruce
Bruce

Reputation: 115

How do I access the ListBox of a TComboEdit in FireMonkey?

I can easily access the ListBox of a TComboBox to change its style properties in the OnEnter event, like this:

combo_box->ListBox->StylesData["shadow.Softness"] = TValue::From<float>(0.3 * magnify_ratio);

Or, to deselect all items:

for (int i = 0; i < combo_box->ListBox->Items->Count; i++)
    combo_box->ListBox->ListItems[i]->IsSelected = false;

But, how can I do the same for the ListBox of a TComboEdit in the OnPopup event? I got an error:

[bcc32c Error]: no member named 'ListBox' in 'Fmx::Comboedit::TComboEdit'

Upvotes: 1

Views: 160

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597941

Try type-casting the TComboEdit::Presentation property to TStyledComboEdit and then use the TStyledComboEdit::ListBox property, eg:

#include <FMX.ComboEdit.Style.hpp>

static_cast<TStyledComboEdit*>(combo_box->Presentation)->ListBox->...

Upvotes: 2

Related Questions