PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home â†’ WINDEV 2024 â†’ Infinite Progress Bar
Infinite Progress Bar
Started by John Fligg, Aug., 17 2017 11:58 AM - 24 replies
Posted on August, 17 2017 - 11:58 AM
Hi, I am having trouble implementing an Infinite Progress Bar.

I am trying ThreadExecute to open a Sister Window but having no success. Basically I need to find out how to make the progress bar animate.

Does anyone have a small app demonstrating how to do this or explain the logic of what needs to be done.

I do wonder if what I am actually trying to do is complicating this.

In my Login Window based on a response I then want to display a progress bar while a daisy chain of procedures run (including accessing a remote server) and show the progress bar animated while all this happens in the background.

I hope this makes sense. Thanks so much in anticipation.

John
Posted on August, 17 2017 - 12:49 PM
Hi John,

You can use an image with animated gif to show that someting is happening.
Additionally you can also use some progress in a progressbar.
Set the maximum value to the number of procedures that need to be done an increment the progressbar when a procedure has finished.
On top of that you can also display "connecting to server", "loading data" etc.

Kind regards,
Piet
Posted on August, 17 2017 - 1:08 PM
Thank you Piet. Do you need to run the procedures in another thread (ThreadExecute)?

Thx
Posted on August, 18 2017 - 2:09 PM
Hi John,

As the user needs to wait for the login process to finish anyway, there's no need for another thread.
Don't forget to do a multitaskredraw to update the controls:
img_Wait..visible=true //show your animated gif. stc_Message..visible=true stc_Message="Connecting to the server" multitaskredraw() Procedure1() PROGBAR_ProgBar1 = 1 stc_Message="Loading data" multitaskredraw() Procedure2() PROGBAR_ProgBar1 = 2 multitaskredraw() etc. img_Wait..visible=false You could also show these controls and do the procedures in a small child window. Then you don't need to do the visible/invisible stuff.

Kind regards,
Piet
Posted on August, 18 2017 - 2:14 PM
Thank you Piet. I have been trying all sorts.

I have actually got the control working and animated but once the procedure has finished I cannot find out how to return to the MainThread. There is a command to stop the secondary thread but it is not available in Android. That is so frustrating.

So I will try your method Piet but I do need to implement the animated control at some stage elsewhere.

Many thanks

John
Posted on August, 18 2017 - 2:43 PM
I do not believe this.

Multitaskredraw is not available in Android.

John
Posted on August, 18 2017 - 3:49 PM
Exceedingly annoying. But even so I can work round it but the animated image does not animate. Grrrr.

I have set the Properties and also made sure it is animated using code.

I think I might just give up on this one!
Posted on August, 18 2017 - 4:00 PM
Hi John,

Sorry to hear that, I thought you were using Windev.

Kind regards,
Piet
Posted on August, 18 2017 - 4:31 PM
In windev mobile you can't use gifs as animated images, you need svg images, if you want to play a gif you can use an HTML control and write html code as if you were doing an HTML page with only the img src tag. Other workaround is to use the hourglass, it is an infinite progress bar and you can write the thing you want it to say. For example:

NextTitle("Loading...")
Hourglass(True)
FOR EACH USER
Multitask(-1)
//Some process
END
Hourglass(False)
NextTitle("")

If you don't write the multitask the animation won't move. Hope this helps, if you are using HTTPRequest to download things there's another way you can do it with a progressbar, in that case you could use HTTPProgressBar before HTTPDestination.
Posted on August, 18 2017 - 6:36 PM
Thank you Luis I was not aware they had to be SVG, The odd thing is that I used the animated GIF's provided by PCSoft.

John
Posted on August, 18 2017 - 8:42 PM
Hi,

I have a similar issue that I have not been able to solve.

When I am running long processes I call a small pop up window using

opensister(win_processing)

and then close that window when the process is complete.

I would like an infinite progress bar to display and re-animate in the "win_processing" window but have not been able to get to work.

I'm using windev 20.

Is this possible? Tips?

Thanks!

Steve
Posted on August, 18 2017 - 8:46 PM
I guess the problem is just in Mobile,'cuz the animated gifs do work in other platforms, I notice this when upgrading to version 22 where a new control of animated images was introduced, I needed to put some gifs in my app, but they didn't move, when I selected a predefined animated image I notice that those were svg instead of gifs.

And as for Steve you could use the hourglass function and before calling the Hourglass use multitaskredraw and then display a gif, haven't done this but it may work, also tried to do the same thing you are doing with a small window and didn't manage to make it work
Posted on August, 19 2017 - 11:06 AM
Well I have managed to move forward slightly.

It seems that the animated GIF's DO work despite being a GIF. So the SVG format is a red herring.

If you place an animated control on the page it works. The problem is this:

If you make the control visible or not or try putting it in another window/plane the animation stops.

Am going to explore putting the control off the screen then moving it on using X/Y to see if that works.
Posted on August, 22 2017 - 8:11 AM
Hi John

Do let us know if you ever get this resolved.

Cheers
André
Posted on August, 22 2017 - 9:45 AM
I've given up Andre. I know it is something to do with running the procedures on another thread, which I have done. The Main thread is supposed to control the animation. But it just does not work, as simple as that.
Posted on August, 23 2017 - 7:36 PM
Just use the Hourglass function, it is an infinite progress bar
Posted on August, 24 2017 - 9:57 AM
It is not available in iOS. Apple do not like anything like this being used.
Posted on August, 24 2017 - 4:54 PM
I'm using the hourglass in iOS
[attachment 2431 Captura-compressor.png]
Posted on August, 25 2017 - 9:53 AM
Hmm must have been mistaken. Ah now I remember. Yes it Is available but at the time I was looking at pubishing to the Store. Then I heard that an Hourglass is rejected by Apple when having your app scrutinized. However I do not use the Stores so maybe I will look at this again. Thx.
Posted on August, 25 2017 - 1:37 PM
Hi John

I am using the hourglass and it does work. But I also always display a message so that the user knows what is happening. If software on hardware does not always tell warmware what is happening they tend to think the thing is hanging and it is in an infinite loop.

But best keep way from the progress bars. I also never got them to work.

Cheers
André
Posted on August, 25 2017 - 3:04 PM
What Msg command are you using out of curiosity? Obviously if you use Info() then the user has to press a key. So it has to be something not requiring a response. Thx.
Posted on August, 25 2017 - 11:30 PM
For the message being displayed while the hourglass is showing you can use NextTitle("Text you want to show") and then call Hourglass(True)
Posted on August, 26 2017 - 7:50 AM
John - I am simply hiding and making visible a string that has a good background colour. It is that simple. I place it on plane 0 - together with other bits and bobs. It has proved to be quite effective. Humans no longer wonder what is going on.

I have not tried Luis's suggestion.

André
Posted on August, 26 2017 - 8:51 AM
Steve,

I have found that an animated gif will not animate in the sister window unless you call it in a seperate thread. Then run your processess. Then close the sister window. This is what I have done.
Posted on August, 26 2017 - 11:23 AM
Thx. NextTitle does not seem to work. And displaying a hidden string doesn't either.

I now think this is something to do with timing. After I click an OK button to start of the process/es nothing seems to work until everything has finished.

In other words, for Android only, once the button has been pressed nothing will redisplay until the other processes complete. Not even changing a plane of making a control visible.

Hourglass does work but NextTitle does not do anything.

Very very frustrating indeed. But Windows and iOS are fine it's just Android which seems to be the issue.