Home > Back-end >  Delphi7 listview dynamic refresh data, need not to empty the list every time you refresh
Delphi7 listview dynamic refresh data, need not to empty the list every time you refresh

Time:09-20

Write a task manager with delphi7, automatically refresh every time can only empty list and then in the process of loading, so refresh process can't do the selected
How quiet like system task manager to update the data

CodePudding user response:

Add the process, it is ok to update only add data item, no empty list,
 
Caption ListView1. Items [I]='the ith line of Caption;
ListView1. Items [I]. SubItems. Strings [j] :='the ith row first son j column;

CodePudding user response:

reference 1st floor santiaodahan response:
add the process, it is ok to update only add data item, no empty list,
 
Caption ListView1. Items [I]='the ith line of Caption;
ListView1. Items [I]. SubItems. Strings [j] :='the ith row first son j column;

 
Index starting from 0, ranks ordinal should add 1:
Caption ListView1. Items [I]='the I + 1 line of Caption;
ListView1. Items [I]. SubItems. Strings [j] :='the I + 1 row son j + 1 column';

CodePudding user response:

Clear the listview rewritten, saving,

CodePudding user response:

All the process of search to the activities of the load to the ListView, ListView status bar shows have stopped end of the process, process started ListView status bar displays is running, the new process is added to the ListView last line!

CodePudding user response:

Build a list of threads, refresh data in four steps:
The first step is to traverse the list of threads, and find out (of the end of the thread), deleted,
Every two steps to add new thread to the thread list,
Every three steps, the thread list, sorting,
The fourth step, the thread list, 0 to n - 1 cycle, corresponding to the Listview, when the two wrong timely, delete the project behind the Listview, then "thread list" project, add to the Listview.

The fourth step is very important, let the Listview minimum change, change the thread before the project basically remain unchanged,

CodePudding user response:

reference 5 floor lyhoo163 reply:
set up a list of threads, refresh data in four steps:
The first step is to traverse the list of threads, and find out (of the end of the thread), deleted,
Every two steps to add new thread to the thread list,
Every three steps, the thread list, sorting,
The fourth step, the thread list, 0 to n - 1 cycle, corresponding to the Listview, when the two wrong timely, delete the project behind the Listview, then "thread list" project, add to the Listview.

The fourth step is very important, let the Listview minimum change, change the thread before the project basically remain unchanged,

The idea is very good, I try

CodePudding user response:

There are other ideas

CodePudding user response:

Each process before exit has a unique id number, Listview items have a IndexOf method can locate row index (circulation), list every time after the completion of update each item data can be directly, it's easy to add or remove inserting data, each time to empty can, but there will be flashing, choose only need to put the last selected according to their id selected is set to True,
  • Related