如何在 FireMonkey 中访问 TComboEdit 的列表框?

问题描述 投票:0回答:1

我可以轻松访问

ListBox
TComboBox
以在
OnEnter
事件中更改其样式属性,如下所示:

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

或者,取消选择所有项目:

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

但是,如何对

ListBox
事件中
TComboEdit
OnPopup
执行相同操作?我收到一个错误:

[bcc32c错误]:'Fmx::Comboedit::TComboEdit'中没有名为'ListBox'的成员

delphi firemonkey c++builder delphi-10.4-sydney
1个回答
0
投票

尝试将

TComboEdit::Presentation
属性类型转换为
TStyledComboEdit
,然后使用
TStyledComboEdit::ListBox
属性。

static_cast<TStyledComboEdit*>(combo_box->Presentation)->ListBox->...
© www.soinside.com 2019 - 2024. All rights reserved.