Page 1 of 1
Use ActivityIndicator while a query finishes
Posted: Sun 22 Mar 2020 03:42
by felixbcastillo
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...
Re: Use ActivityIndicator while a query finishes
Posted: Sun 22 Mar 2020 10:30
by ertank
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.
Re: Use ActivityIndicator while a query finishes
Posted: Sun 22 Mar 2020 13:55
by felixbcastillo
Can you show a sample code?
Please!
Re: Use ActivityIndicator while a query finishes
Posted: Mon 23 Mar 2020 16:48
by ViktorV
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.
Re: Use ActivityIndicator while a query finishes
Posted: Wed 25 Mar 2020 04:22
by felixbcastillo
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...
Re: Use ActivityIndicator while a query finishes
Posted: Wed 25 Mar 2020 15:21
by ViktorV
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.