0

In Delphi 12.0, I'm using Firemonkey TListview.

I link a dataset to it so the contents show the dataset correctly. However if I modify a record it will not update the changed row in TListview.

aDataset.Refresh - does not work

LinkFillControlToField.Active := False / True works but as dataset is big, it takes too long to refresh the entire Listview

Listview.Repaint - does not work

Listview.Items[ItemIndex].Invalidate - does not work as it merely marks it invalidate for future painting. I don't see any more methods for TListviewItem for refresh purpose.

I know one way is to set each of the items in TListviewItem to my dataset manually.

However, I'm using dynamic mode, so it is difficult to have to code each TListviewaccording to different item names (in the TListviewItem) to set to the record data all over again. Think 20-30 TListview and it already starts to feel like never-ending code.

Is there a more elegant solution that can force TListview to re-draw just that one single TListviewItem row that changed? (I know the ItemIndex as I can record it before I edit the row)

4
  • You miss ListView.BeginUpdate/ListView.EndUpdate ? Commented Mar 24 at 7:22
  • I believe that is only for efficient visual update purpose. Does not affect the reason the TListviewItem child of TListview does not update. Commented Mar 24 at 11:10
  • For me (longtime ago) I used LinkFillControlToField.Active/False to correct a display bug But I never test with a big dataset. Commented Mar 24 at 11:14
  • Big datasets are too slow to use above. I think it basically redraws everything. Commented Mar 24 at 13:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.