简体   繁体   中英

how can i solve my Livebinding and combobox problem

i have a dataset ( mysql ) bind with a combobox, i have seen a problem on it so i add a stringgrid to demonstrate the problem.

活绑定

combobox3 和 stringgrid2 都链接

when i click on XMPS combobox list is ok (combobox and stringgrid show same things ) 组合框好

when i click on XMPSSCO combobox and stringgrid show the single result, this is ok组合框好

but when i click on combobox, it list the previous data when stringgrid is correct在此处输入图像描述

Has anyone faced this problem? What have i done wrong? Is this a bug?

Thanks Claude

The same thing happens to me in D10.4

Try DropDownkind property from the ComboBox. Change from Native to Custom.

TComboBox.DropDownKind = Custom

Only that. It works for me. Ugly in android but you solve while you look for more options.

Alternatives: Woll2woll components or try in the new Delphi D11

I found the same pain in other forums. Going through the TComboBox code, I found that livebindings doesn't trigger the Change event (for some reason);

Add a ComboBox.Items.Add(''); before the.execute of the dataset (this forcing the change event) and it works.

MyComboBox.Items.Add(''); //Force the trigger OnChange
MyDataSet.Execute;

I like this solution more than the previous one, because you keep the native mode.

I understand that it should be something provisional, but it is 1 line, and it solves this penalty for the moment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM