Use ActivityIndicator while a query finishes

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
felixbcastillo
Posts: 33
Joined: Tue 25 Nov 2014 17:26

Use ActivityIndicator while a query finishes

Post by felixbcastillo » Sun 22 Mar 2020 03:42

Hi!

I want to have an activity indicator working (active) while the query is still processing data.
How is it possible?

ActivityIndicator1.Active:=true;
qUniQuery1.Execute;
ActivityIndicator1.Active:=false;

I tryied to use threads/tasks but it did not work!
Thanks in advance...

ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

Re: Use ActivityIndicator while a query finishes

Post by ertank » Sun 22 Mar 2020 10:30

Hello,

I do believe you will need to run query in a thread in order to have your animation/indicator to be able to "animate/display as expected".

Otherwise, query execution will run on GUI thread (aka main thread) and your result will not be as expected. Your shared code is exactly this second case here.

felixbcastillo
Posts: 33
Joined: Tue 25 Nov 2014 17:26

Re: Use ActivityIndicator while a query finishes

Post by felixbcastillo » Sun 22 Mar 2020 13:55

Can you show a sample code?
Please!

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Use ActivityIndicator while a query finishes

Post by ViktorV » Mon 23 Mar 2020 16:48

felixbcastillo wrote: Sun 22 Mar 2020 03:42 Hi!

I want to have an activity indicator working (active) while the query is still processing data.
How is it possible?

ActivityIndicator1.Active:=true;
qUniQuery1.Execute;
ActivityIndicator1.Active:=false;

I tryied to use threads/tasks but it did not work!
Thanks in advance...
UniAC itself can change the cursor to hourglass while executing the query and fetching data. For this, it is enough to add the UniDACVcl module to the uses section of your module.

felixbcastillo
Posts: 33
Joined: Tue 25 Nov 2014 17:26

Re: Use ActivityIndicator while a query finishes

Post by felixbcastillo » Wed 25 Mar 2020 04:22

Well, you do not say what I want to hear!

Can I custom that hourglass cursor?
Can I use an animated cursor?

Thanks in advance...

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Use ActivityIndicator while a query finishes

Post by ViktorV » Wed 25 Mar 2020 15:21

After adding UniDACVcl.pas to your project, the cursor will be changed to hourglass cursor, but won't be customizable. If you'd like to customize the cursor, you have two options: 1) get UniDAC Professional with source code and change the cursor, which appears after adding UniDAcVcl, yourself. 2) implement the needed functionality yourself, without involving UniDACVcl.

Post Reply