我正在使用Delphi10.2.3中的ListView开发FMX (Android)应用程序。我将Listview实况(绑定)绑定到带有(Synch->*)的ClientDataSet上。这非常有效,Listview中的任何更改都会传播到ClientDataSet,包括ClientDataSet's事件处理程序,例如BeforeUpdate、Post和AfterScroll。
现在,当我在programmatically,中移动记录指针时,Listview 不会将与更改同步。Livebinding似乎只能“单向”工作(从UI到Dataset)。
我如何使Listview遵循ClientDataSet,就像它在使用DataSource时在VCL中所做的那样?
// here I expect the see the selected item start at the first item
// in the UI in index order and move quickly down through the
// list until it stops at the last one. This doesn't happen. The UI remains
// unaffected.
ClientModule.CDSData.First;
while not ClientModule.CDSData.Eof do
begin
ClientModule.CDSData.Next;
Sleep(100);
end;发布于 2018-10-06 08:10:01
这个问题的简单答案是执行一个
if ClientModule.CDSData.Locate('PKID', VarArrayOf([PKIDValue]), []) then虽然使用CDSData.Next移动记录指针并不同步到Live(绑定) Listview,但是使用locate进行同步。
https://stackoverflow.com/questions/52660234
复制相似问题