PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD20] ParallelTask - Progressbar for httpSend
[WD20] ParallelTask - Progressbar for httpSend
Iniciado por guest, 07,oct. 2015 14:34 - 2 respuestas
Publicado el 07,octubre 2015 - 14:34
Hi,

I am dealing with the new ParalleTask functions. It's very interesting for my application because I use httprequests to get results from my database and the user must wait a lot and the computer is locked during this.

It works so far ... but how can I show a progressbar ?

HttpSend runs in a parallel task and there is no access to any control ....
Publicado el 07,octubre 2015 - 16:43
Call a procedure that runs on the main thread and displays a progressbar? You can set a procedure to run on the main thread by clicking the "1:30" timer button to the top-right of the procedure. Then choose main thread.
Publicado el 07,octubre 2015 - 19:22
Hi Curtis,

its much easier:

In the parallel task procedure:

cMyRequest..DownloadProgress..Procedure=HttpRequest_Progressbar_prepare

than :

procedure HttpRequest_Progressbar_prepare(TotalByte, TotalTransmitted)

ExecuteMainThread(HttpRequest_Progressbar,TotalByte,TotalTransmitted)

and

procedure http_request_progresbbar(TotalByte,TotalTransmitted)

Gauge(TotalTransmitted/TotalByte*100)
Multitask(-1)

Wow, what for a long waiting feature and how easy to implement. Thanks PCS !

Now the user can do things while waiting for the end of the httprequest.

The only thing I don´t get to run is cancel the task. I like to give the user a abort button.

I use

ParallelTaskRequestCancelation(ATask)

atask..canceled is true but the task runs till end ....