Reputation: 1117
I am getting some data from database and displaying to user using Grid. As data size is very large it will take few seconds to load data to grid. I trying to show Loading cursor symbol while process of loading data is going on.
LockGrid(); // This will disable the controls so user can not make any event.
// Want to dispaly loading symbol here.
Start updating data
UnlockGrid(); // release the controls
Any ideas to accomplish this. Thanks
Upvotes: 2
Views: 1553
Reputation: 15817
Another approach would be to use an OnProgress callback to either animate an icon, or increment a progressbar, like in this question: How to see progress of query execution during handle?
Upvotes: 1
Reputation: 108948
Doesn't
Screen.Cursor := crHourGlass;
try
// Do the job
finally
Screen.Cursor := crDefault;
end;
do the job?
However, you might also want to consider putting the work in a separate thread. After all, if you don't, your UI will become unresponsive during the entire job.
Depending on the type of grid, you might also be able to call BeginUpdate
before and EndUpdate
after the loading of the data. That might speed up the process significantly.
Upvotes: 4